Mem leak : malloc/free + pthreads = leakage?

Eric Anderson anderson at ttel.com
Sun Mar 6 04:32:00 UTC 2011


On Mar 5, 2011, at 6:23 AM, Eygene Ryabinkin wrote:

> Fri, Mar 04, 2011 at 10:02:45PM -0600, Eric Anderson wrote:
>> I have a moderately threaded userland program (all C) I am working
>> on (using pthreads, freebsd 8.1 64bit).  It seems to leak memory
>> (using standard malloc/free) badly.  I am using pcap to capture
>> packets and process them. I have a handful of libs statically linked
>> in (pcap is one, the rest don't seem to matter - I can remove them
>> and still see the leak).  
>> 
>> Does anyone know of issues regarding malloc/free on multithreaded
>> userland apps?  
> 
> I personally hadn't heard about them, but you can definitely run
> your program under Valgrind's memcheck tool -- it often does the
> good amount of work and detects many leaks.  Valrgind is ported
> to FreeBSD, devel/valgrind.


I tried valgrind from ports, however there were some missing syscalls and such, and when I went to fill them in, could not figure out which it was, and just could not make it fly.  :(

I also tried to make hoard work, but it seems to not be happy in ports on 64bit FreeBSD.

Thanks!

Eric





More information about the freebsd-hackers mailing list