NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: debugging a memory leak



On Fri, May 20, 2016 at 09:56:42PM +0200, Manuel Bouyer wrote:
> Hello,
> what tools do we have on NetBSD to find a memory leak in a userland
> program (actually OpenCPN - which is a large C++ program with dynamic
> libraries and uses dlopen()) ?
> 
> The memory usage of the process is slowy growing, until the systems
> gets out of ram/swap and kills it (on my evbarm which has no swap it
> takes about 2 days).

thanks for all the replies.
I ended up debugging this on linux with valgrind. It has been very helpfull
at locating the memory leak, and then spotting the double-free that my
fix introduced (the double-free would just cause a segfault in an
unrelated part on NetBSD).

If I had to track this down on NetBSD I think I would have instrumented
malloc/free with utrace(2), including the memory addresses and the
address of the caller.

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index