[Top][All Lists]

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

Re: debugging memory leaks

From: adler
Subject: Re: debugging memory leaks
Date: Sun, 1 Apr 2001 19:40:31 -0400 (EDT)

On Fri, 30 Mar 2001, John Day wrote:
> "dmalloc" is another freely-available malloc package, by Gray Watson 
> (, which does memory leak and overwrite detection. Works 
> with C or C++. I use it all the time.


I've tried dmalloc and it seems to do a good job.
I haven't gotten around to trying the other suggestions I
was given, since dmalloc seems to be doing the job.
I like the fact that I don't have to recompile octave with it,
just the DLD functions I'm debugging

I've used it like this

1. Add #include <dmalloc.h> to DLD funtion.

This has to be after all other defines and octave class
definitions - otherwise it will conflict with octave.

2. compile with

mkoctfile blah   -ldmalloc -ldmallocxx

(I wasn't sure which lib to add, so I added them all)

3. set dmalloc options
e.g.  dmalloc -l logfile -i 100 low   

4. run octave, quit and check the logfile

Note that one must clear variables before quitting octave,
otherwise they will be seen to be leaked.

However, one can't just use 'clear' - this
prevents dmalloc from generating the logfile.
I don't understand why this is!

Andy Adler,                address@hidden

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]