Greetings.

Excuse me if this is a stupid questions.

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));
   
    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 ?


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 disclaim...@is.co.za and a copy 
will be emailed to you.

_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to