Question

I am trying to find the source of a memory leak as detailed here :

Unable to Release Quartz 2D and Core Text created Images

When I use instruments I can see that there is something called CG Raster Data steadily growing in size which is never released.

Does anyone know what could be causing this and how to remedy ? It looks like this might be some sort of image caching, but is it possible to flush this from code ?

Was it helpful?

Solution

I had the same issue with CG Raster Data memory increasing by simply pushing and popping a view controller repeatedly. I spent a while thinking it was an issue with some drawing code. I finally tracked it down to a delegate not weakly referencing the view controller that was being pushed and popped, so when I popped the view controller, it wasn't being deallocated. The CG Raster Data happened to be the biggest part of that view controller's footprint, so I mistakenly attributed the problem to that initially, when it was really the view controller itself that wasn't being released (therefore, not releasing its views, some of which had CG Raster Data).

In short: if you're seeing memory leaks with CG Raster Data, look at view controllers that might have views with them, and make sure that they are being released.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top