Re: checking for memory leaks in gtk



On Friday 02 May 2008 2:18:04 pm Ovidiu Gheorghies wrote:
> Hi,
>
> Could you post the full output of the following (use the -g flag when
> compiling):
>
> export MALLOC_TRACE=0.mtrace.log
> export G_SLICE=always-malloc
> export G_DEBUG=gc-friendly
>
> gcc -g [more-compilation-options] helloworld.c -o helloworld
>
> valgrind --tool=memcheck --leak-check=full ./helloworld
>
> mtrace ./helloworld $MALLOC_TRACE

The last command will report "No memory leaks". But it is a bogus and useless 
result. 

I've added an explicit leak in the program and that last command still 
reports "No memory leaks", even though valgrind sees the increase in leaked 
memory.

This is probably due to the fact that valgrind replaces the calls to malloc, 
realloc and free while mtrace counts the leaks produced by these functions 
(that are no longer used when run under valgrind).

So, till I get some better solution, I'll stick with the valgrind suppression 
files.

Cheers,

Johnny


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