Azure/Cairo content leaks substantial amounts of memory upon completion of the maze. This was traced back to cairo surface memory leak in DrawTargetCairo::CreateSimilarDrawTarget() which is called frequently in Canvas code.
Created attachment 650363 [details] [diff] [review]
Fixed cairo surface memory leak in DrawTargetCairo::CreateSimilarDrawTarget()
Note that Init() calls cairo_surface_reference() so the call to cairo_surface_destroy() cancels that out.
Can't we just change Init() to not add a reference to the surface?
That would be another option but it would change the meaning of Init(). This would mean Factory::CreateDrawTargetForCairoSurface() would need to call cairo_surface_reference() before calling Init(). This would spread the reference counting logic across files.
Avoiding the extra reference/destroy could be achieved by creating an internal version of the Init() function which doesn't call cairo_surface_reference().
Let's do that then.
Created attachment 650711 [details] [diff] [review]
Fixed cairo surface memory leak in DrawTargetCairo::CreateSimilarDrawTarget() v2
Created an internal init method that doesn't call cario_surface_reference()
Created attachment 651879 [details] [diff] [review]
Fixed cairo surface memory leak in DrawTargetCairo::DrawSurfaceWithShadow()
Missing cairo_surface_destroy call.
(In reply to Anthony Jones (:kentuckyfriedtakahe) from comment #8)
This is showing Windows XP gfxASurface leaks, no?
Resubmitted to try without the faulty patch (from another bug). Note that the DrawTargetCairo code path affected by these patches is yet to be enabled on Linux.
(In reply to Anthony Jones (:kentuckyfriedtakahe) from comment #10)
Green on Try.
Apparently part of this fix got lost in the original landing. Landed a follow-up for it.
And on aurora too.