Re: Does GTK leak memory



On 06/02/2010 02:33 PM, Lothar Scholz wrote:
> Why? GLIB/GTK is clearly using its own heap so there is no reason to
> go into libs.

Umm, GTK *is* a lib.  It's dynamically loaded at runtime by the binary.
 So the at_exit() problems would definitely apply here.  And as folks
have been trying to tell you, if you do leak detection on a GTK app
without a suppression file, you'll see apparent leaks from the entire
set of dependent libraries which each do their own heap allocations.

> Suppression files?
> Please tell me more about it.

A suppression file suppresses reports of memory leaks in a leak detector
utility such as valgrind.  You claim to have programmed in C for 25
years, but I'm very surprised you have never used a leak detection tool
before.

What I do is build debug version of GTK, then use an environment
variable (google it) to disable the gslice allocator, and then do the
leak tests.  Sometimes I'll unit test parts of my app and run something
part in a loop thousands of time and watch the memory usage in a
profiler.  As long as it doesn't grow beyond a certain bound I  know I'm
good.


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