Mem leak : malloc/free + pthreads = leakage?

Deomid Ryabkov myself at rojer.pp.ru
Sat Mar 5 17:01:22 UTC 2011


On 03/05/2011 04:02 AM, Eric Anderson wrote:
> Hi all,
>
> 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.
as opposed to what? OpenBSD? Linux? Windows? why do you think your problem is specific to FreeBSD (as evidenced by your post to a FreeBSD-specific list) or is related to threaded 
programs?

>    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?
hell yeah. it goes like this: you malloc() then forget to free() - boom, you have a memory leak.

you're welcome.


sarcasm aside, those questions still remain: why do you think os/libraries are the problem and not your code?
you can't post all of it, ok, and we don't want all of it either. can you isolate a specific example of where valid usage of a library causes a leak?

> Sorry, I can't post the code..
>
> Thanks!
> Eric
>
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"


-- 
Deomid "rojer" Ryabkov
myself at rojer.pp.ru
ICQ: 8025844



More information about the freebsd-hackers mailing list