Greetings.
I have a thread socket application that seems to be behaving strangely
In a worker thread, I have the following.
<CODE>-----------
LogMessage(DEBUG_0, "allocated %ld", malloc_usable_size(inst));
free(inst);
LogMessage(DEBUG_0, "after free allocated %ld", malloc_usable_size(inst));
free(inst);
return 0;
-----------</CODE>
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:
<CODE>------------------
char *z;
z = (char*)malloc(1000);
printf("malloc is %ld\n", malloc_usable_size(z));
free(z);
printf("after malloc is %ld\n", malloc_usable_size(z));
------------------</CODE>
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 [email protected] and a copy
will be emailed to you.
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[email protected]"