some random notes about gtk memory use

yesterday jeff asked me how much memory an applet using the new applet api used so i looked into it. i really only cared about writeable memory.

i was shocked to find out that a very simple applet uses almost 1.5MB of memory.

for comparison i made a few small gtk programs to test. i’m just sharing the results here in case anyone is interested

a program that calls gtk_init/gtk_main uses about 160kB of heap

a program that creates a single window and shows it uses about 250kB of heap

a program that creates a single gtklabel and puts it inside of that window before showing both of them uses ~1200kB of heap

so creating the first gtklabel uses almost a meg of memory. i looked into this and it turns out that a huge chunk of this memory is allocated by pango inside of its opentype handling code “harfbuzz”. the code responsible for the vast majority of the memory allocated in this way is the harfbuzz-gpos code. i have no idea what this code does but if i had to guess, it tells you how far apart two glyphs need to be drawn in order to look right.

i know that recently (december 2006) behdad has been working on this thing called harfbuzz-ng. i sure hope it fixes this problem. :)

that’s all, really.