[cairo] [PATCH] Fix Analysis Surface Memleak
cworth at cworth.org
Thu Apr 27 06:03:20 PDT 2006
On Thu, 27 Apr 2006 08:40:39 -0400, "Dominic Lachowicz" wrote:
> Instead of introducing new API, maybe it would be better to instead
> implement surface_backend->finish_surface for the analysis surface if
> it's leaking memory. It would look something like the attached patch,
> with the "code goes here" part filled in.
Yes. it would be something like if the analysis surface we're leaking
memory on its own. But I don't see that, (I don't see the analysis
surface ever allocating anything on its own for that matter).
> On 4/27/06, Henning Noren <henning.noren.402 at student.lu.se> wrote:
> > Please double check that the second _cairo_analysis_surface_destroy
> > really is needed. All test seems to pass fine but I'm not that familiar
> > with the code.
Within the cairo implementation we generally only have generic
_destroy functions for "objects" with multiple variants. So making an
analysis-surface-specific variant of cairo_surface_destroy doesn't
match the style.
And the only thing you're actually freeing is the surface pointer
itself, which cairo_surface-destroy already does, (at least once it
has already been called enough times to cancel each call to
cairo_surface_reference). What looks obvious to me is that there is
one call to cairo_surface_destroy missing in a spot you've pointed
So I've gone ahead and committed what's below. Does that help with the
specific problem you were looking at, or is there some other
reference-counting problem here?
Author: Carl Worth <cworth at cworth.org>
Date: Thu Apr 27 06:02:46 2006 -0700
paginated: Remove memory leak of analysis surface from _paint_page
Thanks to Henning Noren <henning.noren.402 at student.lu.se> for pointing this out.
diff --git a/src/cairo-paginated-surface.c b/src/cairo-paginated-surface.c
index b839556..da6a60b 100644
@@ -241,6 +241,8 @@ _paint_page (cairo_paginated_surface_t *
_cairo_meta_surface_replay (surface->meta, surface->target);
+ cairo_surface_destroy (analysis);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060427/309afa23/attachment.pgp
More information about the cairo