Reputation: 36013
I have created a 800x1200 context using this line:
CGSize sizeX = CGSizeMake(800, 1200);
CGLayerRef objectLayer = CGLayerCreateWithContext (context, sizeX, NULL);
over this context I have a CGLayer that is 2250x2250 pixels.
This layer (objectLayer) is drawn using something like
CGRect LayerRect = CGRectMake(0,0, layerW, layerH);
CGContextDrawImage(objectContext, LayerRect, myImage.image.CGImage);
CGRect superRect = CGRectMake(0,0, sizeW, sizeH);
CGContextDrawLayerInRect(context, superRect, objectLayer);
according to my math, a 800x1200 context at 24 bpp, should be using 2.8 Mb and a 2250x2250 layer at 32 bpp should be using 20 Mb. So, in total both should be using about 23 Mb.
The problem is that instruments report just the layer to be using 38.62 Mb !!!!
How can that be? Is that some I am missing?
thanks for any help.
Upvotes: 1
Views: 446
Reputation: 36013
apparently there's no solution for that. It appears to be a problem on the API.
Upvotes: 1
Reputation: 75077
Are you sure you are creating the layers without alpha channels? I think by default there is an alpha channel, so it's four bytes instead of three...
Upvotes: 0
Reputation: 104718
The answer or best details are likely about 2 clicks away (to find the source of the allocation in the call stack) in Instruments.
Where is the allocation? Locate the source doc of the offending call; Does it specify allocation amounts? Does that differ from your expectations/findings/use?
Upvotes: 0