Re: Memory Leakage



Matthew Russell <twig5151 yahoo com> writes:
I'm having a problem with leaking memory from a
dialog box. It contains a notebook with 4 pages,
one of which just contains a few labels and
buttons, whereas the others contain fairly large
sized Clist. When I come to destroy the window,
it seems to leak about 100k, according to top.
(This is based on creating and destroying several
of these dialogs in sequence.)

Top's memory usage does not mean much about whether you have leaked
memory. top reports memory given to the process via brk(). The C
library malloc() implementation, and also lots of the stuff in GLib,
will cache memory from brk() even though the app has freed it, because
brk() is a system call and therefore sort of expensive. Also, memory
fragmentation can force malloc to keep memory chunks from brk() even
though they aren't fully used.

To catch mem leaks, use a tool such as memprof, and be very sure what
the memory management rules are for the API you're using.

Havoc








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