threads and malloc/free on freebsd 8.0
Vikash.Badal at is.co.za
Fri Jun 11 19:23:49 UTC 2010
I have a thread socket application that seems to be behaving strangely
In a worker thread, I have the following.
LogMessage(DEBUG_0, "allocated %ld", malloc_usable_size(inst));
LogMessage(DEBUG_0, "after free allocated %ld", malloc_usable_size(inst));
output> allocated 2304
output> after free allocated 2304
from playing around, this should have segfaulted but it didn't:
if I try this from a non threaded, non socket code:
z = (char*)malloc(1000);
printf("malloc is %ld\n", malloc_usable_size(z));
printf("after malloc is %ld\n", malloc_usable_size(z));
Output> malloc is 1024
Output> Segmentation fault (core dumped)
Can anyone enlighten me ? why did the 2nd free not cause a segmentation fault ?
If im not clear, please forgive me.
Please note: This email and its content are subject to the disclaimer as displayed at the following link http://www.is.co.za/legal/E-mail+Confidentiality+Notice+and+Disclaimer.htm. Should you not have Web access, send a mail to disclaimers at is.co.za and a copy will be emailed to you.
More information about the freebsd-questions