[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Tracking memory leaks -- advice needed
From: Stephan Kulow <coolo () itm ! mu-luebeck ! de>
Date: 1999-06-20 8:45:33
[Download RAW message or body]
Pietro Iglio wrote:
>
> I'm tracking memory usage in kpanel and I need a feature that
> --AFAIK-- is not
> provided by tools such as ccmalloc and leaktracker.
> I need a way to detect how much memory has been allocated between two
> execution
> points. Suppose, for example, that I'm going through the execution
> with gdb and
> I have the following example code:
>
> Foo* foo = new Foo(.....);
>
> fee = buildFeeTree(....);
>
> I would like to call a function (eg.) get_allocated_memory() from gdb
> before
> and after every step to know how many bytes have been allocated by the
> constructor
> of Foo and during the execution of buildFeeTree().
> I have tried to use the __malloc_hook, __realloc_hook and __free_hook
> of the
> glibc library, but somewhere in the runtime the __malloc_hook is reset
> to NULL.
>
> Any help, please?
Well, if you use the dmalloc library (just install dmalloc-0.4 and use
--with-dmalloc in kdelibs), you'll get a function called
dmalloc_log_stats(),
which you can call as many times as you want. Unfortunatly it's output
is
a bit more verbose than say one int :)
Greetings, Stephan
--
Und sie nannten ihn, wie er selbst unterschrieb -
Den Trojanischen Pferdedieb
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic