Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-04-2010, 02:40 AM   #1 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 25
R40ul is on a distinguished road
Default ImageIO_malloc

Hello !
I am currently trying to clean my app in order to optimize it, and so, I'm using Instruments intensively. I managed to block all of my leaks, and most of the allocations that I see in Instruments are under control.
Thus, I have a problem : something like 90% of my live bites are occupied by ImageIO_malloc.

Though, I've already replace all my "ImageNamed" with "imageWithContentsOfFile", but I still have like 60 images allocations.

I would like to know if it's possible to know what this images are, from their address for example, and most of all, I would like to optimize this in order to make my app runable on Iphone3 (for now, it crashes very often because of lack of memory).

I think that I may come from the way I've organized my app : I've got several views in my xib, and a main view which is empty and always visible. When I want to display a view, I push make this :
Code:
-(void)switchToMenuView{
	[currentView removeFromSuperview];
	[UIView beginAnimations:nil context:nil];
	[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self cache:YES];
	[UIView setAnimationDuration:0.35];
	currentView = menuView;
	[self addSubview:menuView];
	[UIView commitAnimations];
}
Is that correct ? Do it releases the ressources of "currentview" ?

Thanks by advance for your help !
R40ul is offline   Reply With Quote
Old 09-04-2010, 05:11 AM   #2 (permalink)
Registered Member
 
Join Date: Jul 2010
Location: UK, North East
Posts: 227
zardon is on a distinguished road
Default

Hi, could the number of image allocations be reduced if you used a sprite sheet to hold images of similar dimensions?
zardon is offline   Reply With Quote
Old 09-04-2010, 06:21 AM   #3 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 25
R40ul is on a distinguished road
Default

Hi, and thanks for your answer,
I have effectively a lot of similar images to display.
If I understood what spritesheets are, it's a big image containing all of the images I'll need in my app, isn't it ?
Is there a way to convert my UIImageView in order to use this easily ?
Would I have to modify my xib, or could I keep my UIImageView as containers ?

And finally, I still have my "Views" problem : I think that all of the images of my app are always loaded. Is there a way to release an Image when its containing view is hidden ?

Thanks
R40ul is offline   Reply With Quote
Old 09-04-2010, 09:31 AM   #4 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 25
R40ul is on a distinguished road
Default

Well, I have tried to put some beakpoints in the dealloc functions of the views I add to my mainView, and none of it is reached.

The views I'm adding (here “menuView") are Outlets of my MainView class, and I define them in IB.
I'm adding and removing views like this :
Code:
-(void)switchToMenuView{
	[currentView removeFromSuperview];
	[UIView beginAnimations:nil context:nil];
	[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self cache:YES];
	[UIView setAnimationDuration:0.35];
	currentView = menuView;
	[self addSubview:menuView];
	[UIView commitAnimations];
}
Why is dealloc not called ?
Thanks for your answers

Last edited by R40ul; 09-04-2010 at 09:38 AM.
R40ul is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 343
11 members and 332 guests
bignoggins, carlandrews, flamingliquid, hzwegjxg, ilmman, iram91419, linkmx, nadav@webtview.com, Objective Zero, stanny, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,656
Threads: 94,116
Posts: 402,889
Top Poster: BrianSlick (7,990)
Welcome to our newest member, iram91419
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 11:45 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0