Date: Fri, 21 May 2010 17:58:31 +0200 From: Vikash Badal <Vikash.Badal@is.co.za> To: "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org> Subject: threads and malloc/free on freebsd 8.0 Message-ID: <9B425C841283E0418B1825D40CBCFA613D9E2689CF@ZABRYSVISEXMBX1.af.didata.local>
index | next in thread | raw e-mail
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 disclaimers@is.co.za and a copy will be emailed to you.
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9B425C841283E0418B1825D40CBCFA613D9E2689CF>
