CG Raster Data - CGProviderCreateWithCopyOfData - Unable to Release?
Asked Answered
C

1

7

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 ?

Colloquial answered 11/12, 2013 at 10:38 Comment(2)
Does memory get freed if you close this screen? If it is, then you'll need to add @autoreleasepool around code that uses images(this might be a loop).Tights
Can you attach your code?Improvident
B
1

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.

Banka answered 5/3, 2015 at 13:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.