Re: checking for memory leaks in gtk

Harinandan S wrote:
> I looked at memory usage using 'top' and 'free' while running the
> application and found that memory kept on increasing without decreasing when
> i destroyed a window and finally application was terminated by MVL.
> Meanwhile 'valgrind'  is not supported on arm-linux platform so i am not
> able to get more details. I'll try to run it on a x86 linux PC with
> valgrind.

Neither top nor free is that useful in determining memory leaks.  As
Paul alluded to, calling free() on a block that was malloc()ed does not
automatically return memory to the system.  It merely frees it on the
heap, which belongs to the application.

The free command under linux can't really help here, since Linux always
over commits memory and thus you should never have more than a small
percentage of your RAM free.

top can be somewhat useful, but only in certain cases.  For example, if
you take your main() function and put it in a loop and run it thousands
of times, then top should report that the VSS (virtual memory) used by
the process never grows beyond a certain bound.

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