Re: Text rendering memory issues



On Wed, 2003-10-22 at 10:55, Dag Helstad wrote:

> I'm developing GTK based software for an embedded environment. Now I'm 
> thinking of migrating from GTK 1.2 to 2.x for its i18n functionality. It 
> works nice, but the problem is memory consumption.
> 
> It seems some part of the glib/pango/gdk/gtk hierarchy allocates a large 
> chunk of memory (approx 1 MB) when the first piece of text is rendered. For 
> instance, on our system, an application with only a main window takes 636 
> kB; the same app with a single button+label takes 1620 kb; with two labeled 
> buttons it consumes 1624kB.
> 
> I've tried snooping around in the code and on the Net, but I can't find 
> anything useful. Does anyone know why this much memory is allocated? And if 
> I knew where the memory is going, would I have any chance whatsoever to 
> reduce the consumption? Is this "just" a matter of memory vs. performance, 
> or is it by design?
> 
> I'm running the GTK suite on a Linux/XFree86 system. All libraries are built 
> in their x11-versions. Pango uses the basic-x module. I have full control of 
> all libraries, fonts, applications and configurations on the system, so if 
> this problem can be solved by changing something outside the GTK-related 
> stuff,  I can do it.
> 
> Any clues, a pointer to docs, configuration options, code, whatever, are 
> appreciated!

First thing I'd do is switch to using fontconfig and basic-xft; the
memory usage may not be that much less, but the code is supported
and actually maintained. Generally, for fontconfig, you can keep the
memory usage low by restricting the number of fonts in your fontconfig
font path. 

(For embedded usage, you probably don't need more than a handful,
especially if you know what languages you need to support before hand.)

If you want to investigate where the memory is going, a tool like 
memprof (http://www.gnome.org/projects/memprof) may be useful.

Regards,
						Owen





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