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 05-11-2011, 09:16 AM   #1 (permalink)
Registered Member
 
Join Date: Sep 2010
Location: Manchester
Posts: 25
treeba is on a distinguished road
Send a message via Skype™ to treeba
Default Memory warnings but no leaks

Hi,

I've been developing an app which is live on the app store but some users have been complaining of crashing (especially on older devices) I have thoroughly checked the app using the leaks instrument and there are no memory leaks. I have also removed all 'autoreleases' where possible.

When I run the app on the 3G I still get memory warnings and after a few minutes the app usually crashes.

Anyone have any idea if I have missed anything?
__________________
Mathster - Maths brain training with a twist!
SoundZen - Generative sound sequencer using cellular logic
treeba is offline   Reply With Quote
Old 05-11-2011, 09:17 AM   #2 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

maybe you are using images with high resolution?
__________________
dany_dev is offline   Reply With Quote
Old 05-11-2011, 09:28 AM   #3 (permalink)
Reading the Documentation
 
baja_yu's Avatar
 
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
baja_yu has a spectacular aura about
Default

There may be no leaks but you could be using too much memory considering an older device. Use Instruments to see just how much and where you allocate memory and see if you can make some optimizations. Follow the general guideline for loading resources lazily, that is, only when you just need them and don't keep them cached.
baja_yu is offline   Reply With Quote
Old 05-11-2011, 09:44 AM   #4 (permalink)
Registered Member
 
Join Date: Sep 2010
Location: Manchester
Posts: 25
treeba is on a distinguished road
Send a message via Skype™ to treeba
Default

We do have a gallery section where we load in some pretty big images but while there is usually a warning here, it's mainly on sections with much smaller images. I do cache the last 10 images but I regularly purge older images and I purge all of them after a memory warning.

Thanks for the help guys, is there anything else that could cause this?

Thanks for the advice baja_yu - I will check it out with instruments now
__________________
Mathster - Maths brain training with a twist!
SoundZen - Generative sound sequencer using cellular logic

Last edited by treeba; 05-11-2011 at 09:48 AM.
treeba is offline   Reply With Quote
Old 05-11-2011, 09:51 AM   #5 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

so most probably are the images, maybe are you using autoresized images, but with an high res? how many image you load together? and which resolution they have?
__________________
dany_dev is offline   Reply With Quote
Old 05-11-2011, 09:54 AM   #6 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by treeba View Post
We do have a gallery section where we load in some pretty big images but while there is usually a warning here, it's mainly on sections with much smaller images. I do cache the last 10 images but I regularly purge older images and I purge all of them after a memory warning.

Thanks for the help guys, is there anything else that could cause this?

Thanks for the advice baja_yu - I will check it out with instruments now
iOS devices are memory-starved. The older the device, the worse it is. The original iPhone is the worst in terms of limited memory. I don't remember the amounts off the top of my head, but the limits are kinda scary. The 3Gs is a lot better, and the iPhone 4 is better still.

You need to write you app to handle low memory warnings and release memory when they get called. If you download images from a server, you can save them to local files. Write your code to check to see if your image pointer is nil before using the image, and reload it from a file if it is. Then write your low memory warning code to release everything it possibly can and set the released object's pointers to nil.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 05-11-2011, 10:01 AM   #7 (permalink)
Reading the Documentation
 
baja_yu's Avatar
 
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
baja_yu has a spectacular aura about
Default

There was a great presentation in the last years WWDC where the presenter was talking about the PhotoScroller (I think) sample code. It mimics some of the functionality of the Photos app, where you have multiple images that you can zoom in/out and scroll through them. One part of the talk was about memory management. The point was, that if it's a very big image, they use several images of it when working with it, several scaled down versions. If you stretch a huge image down to 100x100 for example on screen, in the background iOS will still be using the huge image and it will have an adverse effect on memory and processing. They instead use several different images and switch them dynamically as you zoom in to provide you with a high res image.

See this: Loading…
baja_yu is offline   Reply With Quote
Old 05-11-2011, 11:27 AM   #8 (permalink)
Registered Member
 
Join Date: Sep 2010
Location: Manchester
Posts: 25
treeba is on a distinguished road
Send a message via Skype™ to treeba
Default

Thanks for your help guys, looks like it's definitely a problem due to the iPhone 3G's low memory - I will try all your tips for lowering my use of it

Thanks!
__________________
Mathster - Maths brain training with a twist!
SoundZen - Generative sound sequencer using cellular logic
treeba is offline   Reply With Quote
Old 05-11-2011, 12:17 PM   #9 (permalink)
Registered Member
 
Join Date: Jan 2009
Posts: 280
dapis is on a distinguished road
Default

Quote:
Originally Posted by treeba View Post
Thanks for your help guys, looks like it's definitely a problem due to the iPhone 3G's low memory - I will try all your tips for lowering my use of it

Thanks!
Probably you will be OK if you handle the memory warnings properly. I get a lot of such warnings in one of my apps, but then the app removes all the currently non-crucial data and all is fine. It's never crashed because of a memory error.

It's crucial too that you have dealloc set up to properly dispose of those UIViews that the system will trash on its own - in particular if IBOutlets are not set to nil there, a crash can occur when the view is reloaded.
dapis is offline   Reply With Quote
Reply

Bookmarks

Tags
leaks, memory, objective-c, warning

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: 355
7 members and 348 guests
doffing81, dre, iOS.Lover, Kirkout, MikaelBartlett, oztemel, PlutoPrime
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44
Powered by vBadvanced CMPS v3.1.0

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