[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Memory leaks (Was Re: bounds checker ?)

On Tue, Oct 31, 2000 at 11:36:19AM +0530, Kedar Patankar wrote:
> > Electric Fence is what U are looking for my friend... What's more U can
> > find it with some standard distributions (RH at least), no going around
> AFAIK, electric fence won't tell you *where* there is a memory leak. It
> will definitely show you where you overrun buffers (by making the code seg
> fault at that place).

If one is willing to change code, you can 

#define malloc your_malloc(__FILE__, __LINE__, size)

and get your_malloc to keep track of allocations. Many kernels use this 
trick to track leaks.

Recent BSD kernels have also introduced a "trace buffer" techinque
to keep track of certain interesting activities that can be used
to trace what went wrong in the event of a failure.