NetBSD-Users archive

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

Re: debugging a memory leak



On Fri, 20 May 2016, Manuel Bouyer wrote:
> I though ElectricFence would only detect things like use after free or 
> out of bound access, but not memory leaks ?

Hmm, I thought it did. Like if you try to malloc() over a pointer and 
clobber it before you free()'d the previous one (say in a loop/iterative 
situation). A ghetto reference counter + LD_PRELOAD works pretty well for 
that, too. The only problem is that it makes your app fairly slow for 
testing if it does a lot of dynamic allocation. Neither approach is near 
as good as Valgrind, for sure.

-Swift



Home | Main Index | Thread Index | Old Index