[cairo] mallocs in gstate_save

Vladimir Vukicevic vladimir at pobox.com
Thu Nov 15 15:50:23 PST 2007

On Nov 14, 2007, at 4:09 AM, Chris Wilson wrote:
> 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.)

Hey, this looks great.. I was going to suggest implementing a freelist
when I heard about the allocations in use.  Patches look fine to me,
though Carl or Behdad should have a look as well.

     - Vlad

More information about the cairo mailing list