[cairo] mallocs in gstate_save

Chris Wilson chris at chris-wilson.co.uk
Wed Nov 14 04:09:22 PST 2007

Baz (brian.ewins at gmail.com) said: 
> So, my question is - would it be sensible in this case to just hang on
> to the previous alloc (just reducing allocs rather than addressing the
> fragmentation issue). Something like the code below;
> _cairo_gstate_destroy would become tail-recursive to free this up
> later.

I was profiling swfdec last week and saw that it used save()/restore()
quite frequently and so I added a gstate freelist to cairo_t. My goal at
that time was to build benchmarks for XShm, so I didn't pursue that
digression... (Since then I've been looking at pre-allocating chunks for
the freelists.)
Chris Wilson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gstate-freelist.patch
Type: text/x-diff
Size: 7362 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20071114/9bead99f/attachment.patch 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freelist-chunks.patch
Type: text/x-diff
Size: 3447 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20071114/9bead99f/attachment-0001.patch 

More information about the cairo mailing list