Alex Rivera | Logout

What is CG Raster Data?

Asked 2012-09-19T21:30:18.783
27

I'm trying to find another memory leak in my code, and I can't seem to figure out what CG Raster Data is. While going through the VM Tracker with automatic snapshots enabled, the CG Raster Data seems to be the only part that increases. These also increase steadily without the allocations increasing.

I'm not entirely sure what the CG Raster Data is, nor how I would fix it, but at this point the increasing footprint eventually causes a memory error and crash, so it's not good! I do my own text rendering (using CoreText), so I'm thinking that has something to do with it. I also am loading pictures?

Below is an image of the footprint: Peaks in the allocations when the pages load (the app loads pages with images and text discretely), the dirty memory always increases though.

UPDATE: This problem still persists, but interestingly enough I can correlate it to a leak within UIFoundations to something called "NSConcreteGlyphGenerator." It seems to happen only when I call a "boundingRectWithSize:" method on an attributed string in the CoreText method that actually draws. The line, specifically, is:

[displayString boundingRectWithSize:CGSizeMake( self.frame.size.width, self.frame.size.height ) options:0 context:nil];

Slowly tracking it down...

Edit
Report

1 Answer

2

This is not much of an answer, but just so someone gets the investigation started...

I think CG Raster Data is new with iOS 6, but was present in iOS 5 as CG Image. I tested on both simulators, and on iOS 5, CG Raster Data wasn't present, but if you compare the total amounts on iOS 6 and iOS 5, CG Image is just about equal to CG Raster Data, and CG Image doesn't show up on iOS 6. So I'm pretty sure they just renamed CG Image to CG Raster Data.

As for what CG Image really is, well I've been trying to figure that out for months. I think it's just view layout related things handled by the system, that you don't really control, because my app doesn't really have any UIImages or CG Images, and my CG Image memory is pretty high, so its probably something to do with Core Animation and view layout.

answered 2012-09-29T03:08:22.423

Your Answer