Re: Memory management
- From: "Michael O'Reilly" <michael metal iinet net au>
- To: gnome-list gnome org
- Subject: Re: Memory management
- Date: 04 Dec 1998 10:48:35 +0800
Keith Wright <kwright@tiac.net> writes:
> > From: Felix Bellaby <felix@pooh.u-net.com>
> >
> > However, no garbage collection algorithm is
> > ever as efficient as throwing away garbage when you know that it
> > is garbage.
[ .. ]
> But that is getting pedantic, a widget library does not fit
> either of those conditions. The widgets generaly run on
> simple tree-structured data, garbage accumlates slowly over
> a long time, and garbage creation us usually associated
> with specific actions (such as deleting a window) rather
> than by dropping the last of many links to it in the course
> of a complicated calculation.
Ummm. You may be interested in using ltrace or something to look at
the number of alloc calls your typically gnome program does. Gtk+
makes a LOT of alloc calls, typically for very short lived data.
For example, starting up freecell, clicking on the file menu and
selecting exit causes a total of 12601 calls to malloc() or calloc(),
with another 9321 calls to free().
This is fairly typical. GTK Mozilla uses ~34,000 allocs to start up and
display a blank page. Gnobots uses 427 calloc, 8648 free, 10509
malloc, 1926 realloc.
The vast majority of those calls are for very small chunks of data (8
or 16 bytes).
(note that I'm not using a pure ltrace here. I'm tracing calls to
{m,c,r}alloc from all the libraries as well as the core program).
You may wish to reconsider your assumtions above. :)
Michael
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]