[cairo] Cairo glyph cache heap fragmentation

Kaiser Bernhard bernhard.kaiser at wipotec.com
Mon Sep 15 07:30:07 PDT 2014

We use revision 1.10.0.
We use cairo in order to draw windows in a realtime operating system. During operation windows including text are opened and closed. Looking at the heap I can see, that the largest free block decreases until the heap manager requests memory from the memory manager. After a time the memory in the memory manager is 0 and with the next request of a big memory block (opening a new window, allocating the memory for the surface) we are running out of memory. The total available memory does nearly not decrease in this process, we can get memory in small blocks, but there is no big block available. We tried to find out what happens. We logged all heap operations and found out, that cairo allocates memory to add glyphs to the glyph cache. The glyph cache belongs to the font, not to the window, so if the window is closed (and the memory is freed), this small piece of memory stays allocated 'in the middle of the heap'. We reduced the define MAX_GLYPH_PAGES_CACHED from 255 to 4, and it took much longer to run out of memory.
Can we disable the glyph cache or are there other solutions (update to 1.12.xx?)? Is there a possibility to use static allocated memory for glyph cache?



Bernhard Kaiser
Research & Development

Wipotec GmbH
Adam-Hoffmann-Str. 26
67657 Kaiserslautern

T +49.631.34146-0
F +49.631.34146-8640


Legal information:
Wipotec Wiege- und Positioniersysteme GmbH
HRB 2317 Kaiserslautern, Management: T. D?ppre, U. Wagner

This e-mail may contain confidential and/or privileged information.
If you are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and delete this e-mail. Any unauthorized
copying, disclosure or distribution of the material in this e-mail is strictly
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20140915/30856613/attachment.html>

More information about the cairo mailing list