How much memory alloc an UIImageView 320x480?
Asked
Active
Viewed 296 times
2 Answers
1
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.

Community
- 1
- 1

Carl Norum
- 219,201
- 40
- 422
- 469
-
`sizeof` is not useful at all for determining the memory use of Objective-C classes. – rpetrich Feb 25 '10 at 18:43
-
@rpetrich, that's kind of what I was trying to get at; edited for better information. – Carl Norum Feb 25 '10 at 19:02
1
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
- 32,196
- 6
- 66
- 89