[cairo] cairo-xlib patch to release glyph surfaces
jeff at infidigm.net
Thu Oct 18 07:50:30 PDT 2007
On Thu, Oct 18, 2007 at 03:52:46PM +0200, BJörn Lindqvist wrote:
> On 10/18/07, Behdad Esfahbod <behdad at behdad.org> wrote:
> > I'd like to commit the attached patch to cairo-xlib that makes it
> > release glyph surface after uploading it to the X surface iff the
> > surface didn't exist in the cache before we asked for it.
> > The reasoning is that right now, applications render glyphs to images,
> > upload it to the X server, and keep a local copy in the cache. The X
> > server works hard to reuse glyph renderings, by hashing glyph images and
> > reusing them. So we are wasting memory in cairo apps that don't use the
> > glyph surface after uploading to the server, which is the case if you
> > don't use the glyph in an image surface.
> So the patch reduces memory consumption? Is there a way to measure the
> improvment? For example, if I have an app that takes 1800kb memory
> without and 1300kb with the patch applied. And thinking along the same
> lines.. Cairo already has correctness tests and performance tests,
> maybe tests that check memory consumption would also be useful?
I've written a set of malloc hooks (like malloc-stat.c) that track the
maximum amount of memory used. I plan on using them for tracking memory
usage in poppler, but if anyone is interested in doing something like
this for cairo I can share a copy.
More information about the cairo