Re: threads and malloc/free on freebsd 8.0

2010-06-11 Thread Dan Nelson
In the last episode (Jun 11), Vikash Badal said: 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

RE: threads and malloc/free on freebsd 8.0

2010-06-11 Thread Vikash Badal
-Original Message- From: owner-freebsd-questi...@freebsd.org [mailto:owner-freebsd- questi...@freebsd.org] On Behalf Of Dan Nelson Sent: 11 June 2010 09:56 PM To: Vikash Badal Cc: freebsd-questions@freebsd.org Subject: Re: threads and malloc/free on freebsd 8.0 The fix

Re: threads and malloc/free on freebsd 8.0

2010-06-11 Thread Dan Nelson
In the last episode (Jun 11), Vikash Badal said: -Original Message- From: owner-freebsd-questi...@freebsd.org [mailto:owner-freebsd- The fix is to remove your second call to malloc_usable_size(z)). Then neither version will crash. Also, a useful habit to start is to

Re: threads and malloc/free on freebsd 8.0

2010-05-25 Thread Anoop Kumar Narayanan
On Sat, May 22, 2010 at 1:56 AM, Dan Nelson dnel...@allantgroup.com wrote: In the last episode (May 22), Anoop Kumar Narayanan said: I think glibc uses asynchronous free, as in it doesn't free the memory immediately.  So even though the memory is free'd its still part of the process's address

Re: threads and malloc/free on freebsd 8.0

2010-05-21 Thread Dan Nelson
In the last episode (May 21), Vikash Badal said: 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));

Re: threads and malloc/free on freebsd 8.0

2010-05-21 Thread Anoop Kumar Narayanan
I think glibc uses asynchronous free, as in it doesn't free the memory immediately. So even though the memory is free'd its still part of the process's address space but present in the free pool and so it doesn't crash. -Anoop On Sat, May 22, 2010 at 12:48 AM, Dan Nelson dnel...@allantgroup.com

Re: threads and malloc/free on freebsd 8.0

2010-05-21 Thread Dan Nelson
In the last episode (May 22), Anoop Kumar Narayanan said: I think glibc uses asynchronous free, as in it doesn't free the memory immediately. So even though the memory is free'd its still part of the process's address space but present in the free pool and so it doesn't crash. FreeBSD