Re: What is using up so much memory here?
Re: What is using up so much memory here?
- Subject: Re: What is using up so much memory here?
- From: James Cicenia <email@hidden>
- Date: Tue, 10 Mar 2009 18:41:53 -0500
Interesting... I didn't know that, but then it begs the question....
what do the cool kids do?
Should I be taking a different approach here? If so, any pointers or
doc chapter would be
great.
Thank you
James Cicenia
On Mar 10, 2009, at 6:33 PM, David Duncan wrote:
On Mar 10, 2009, at 4:26 PM, James Cicenia wrote:
Ok -
Here is the offending code that sucks up about 2MB:
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
while(thisState = [statesEnum nextObject]){
UIImageView *singleStateView = [[[UIImageView
alloc]initWithFrame:CGRectMake(2,0, 293, 184)]autorelease];
[singleStateView setImage: [UIImage imageNamed:[[@"wf-map-gray-"
stringByAppendingString:thisState
]stringByAppendingString:@"_glow.png"]]];
[singleStateView setTag:100];
[fruitStateView addSubview:singleStateView];
}
[pool release];
These are little pngs of the states. They are tiny 4KB images
yet when this loop runs it winds up taking up an additional 2MB
Compressed size does not matter. Your images (or at least your image
views) are 293x184, which means that each view is going to consume
293x184x4 (bytes per pixel) = 210.6K. I presume your looking at the
Memory Monitor tool, as the memory used by view backing stores is
not reflected in the memory usage as reported by the ObjectAlloc
tool, but assuming your PNGs are the same size as the view, that
210.6K number is far more indicative of memory usage than the
compressed size.
--
David Duncan
Apple DTS Animation and Printing
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden