How much memory alloc an UIImageView 320x480?
+1
A:
A bunch? There are helper objects, properties which point to other objects, etc. Trying to track down everything that might happen is probably not worth it. Why do you need to know?
Check out this question which has some good informattion about the runtime.
Carl Norum
2010-02-25 18:19:07
`sizeof` is not useful at all for determining the memory use of Objective-C classes.
rpetrich
2010-02-25 18:43:34
@rpetrich, that's kind of what I was trying to get at; edited for better information.
Carl Norum
2010-02-25 19:02:37
+1
A:
Normally a 320x480 UIView
would consume an additional 320*480*4 bytes for the layer's buffer, but in OS 3.0 UIImageView
was optimized to use the source UIImage
directly.
It has only a small overhead necessary to maintain the high-level UIView
interface. To reduce this even further, you can create a CALayer
and assign the contents directly:
CALayer *layer = [CALayer layer];
[layer setFrame:CGRectMake(0.0f, 0.0f, 320.0f, 480.0f)];
[layer setContents:(id)[image CGImage]];
[[superview layer] addSublayer:layer];
rpetrich
2010-02-25 18:42:41