iPhone 3Gs iOS 5.0.1 get Recieved memory warning error and crash the app - iphone

I have created slideshow in my app and caching images in "CacheDirectory" of iPhone under "images" folder. After 10-15 minutes of slideshow app received memory warning and suddenly get crash without doing anything. But its not getting memory warning and even crash on iPhone 4 or 4s with same iOS.

The iPhone 4 and 4S both have more memory than the 3GS, so if you have a memory leak, or just use a lot of memory the memory warning would come at a later point on the 4/4S.
Wether or not you save the images in the cache directory has no impact on memory usage. You must be keeping more images in memory than possible. When implementing a slideshow that can handle an arbitrary number of images you would have to make sure that images that are not currently displayed are released.

Related

UIImagePickerController crashes app and sometimes restarts the device - memory warning issue

We have customized the camera view and the move&scale options. after taking picture the original image will be opened up in the new view controller which has customized move&scale. It works fine but the app crashes and sometimes os restarts if we are open the camera more than around 7 times continuously. we checked the profile instruments there is no memory leaks its getting released after picture is taken
app throws memory warning continuously after around 7 time continues use of camera
we are using ARC.
Any idea?
i found the answer.there was a problem in image i used for cropping.
See the below links.
http://vocaro.com/trevor/blog/2009/10/12/resize-a-uiimage-the-right-way/
http://wiresareobsolete.com/wordpress/tag/uiimagepickercontroller/

Large UIImage causing low memory and crashes

I have a large image that I load into a UIImageView. The image is a PNG and it's #2x file size is: 384K. The image is 5119x2413 pixels. The image can be zoomed by the user by using pinch gestures. The reason the image is so large is so that when the UIImageView is transformed by pinching the quality will stay the same.
The problem I'm having is that on some devices especially the latest iPod Touch it will crash while attempting to display this screen.
I've ran the app via Instruments and profiled it using the Leak/Allocations profiles. The app's live bytes generally hovers around 4MB when using the app, but as soon as you view the screen containing the UIImageView this shoots up to 40MB! Onces the image is on the screen the memory returns to around 4MB.
The problem I'm having is that more times than not on older devices and ones limited by memory like the iPod Touch my app is being terminated by the system, along with some system services like SpringBoard.
I've tried using [UIImage imageWithContentsOfFile:] instead of [UIImage imageNamed:] to load the image as I am aware that [UIImage imageNamed:] caches the image but this has had no effect.
It seems that the spike in live memory caused when attempting to display the image for the first time is causing a low memory situation and the app is being terminated by the OS.
I'm curious to how I can fix this, and how Apple are dealing with loading large images in the Photos app.
Just for the record I'm using ARC and iOS 5.1.1 with XCode 4.4.1.

App crashes in Retina enabled device with low memory warning But in works perfect in non retina devices

I am developing a cocos2d game which is retina enabled . I have added lots of images in my project for both retina and non retina. Game works fine in simulator [Both retina and non retina], and it also works perfect in non retina devices. But when i run the same in the retina enabled device means it get's crashed without displaying any message. When i test my game with instrument application means it shows low memory warning message like this [http://screencast.com/t/sfRDTELrhomC]. When the app get's crash While running in the retina enabled device it's doesn't show any error message in the console. I am terribly confused with the current state can anyone help me out with this problem.
You are probably using a lot of memory to load images, so the device runs out of memory and kills your application.
I'm guessing you are using PNGs (since you didn't give any info on this); when you load an image from PNG, JPG, etc., the image is loaded into memory twice, since it has to be "translated" by cocos into a texture. Also, texture sizes for this operation has to be a power of 2, so an image of 150x150 would take the memory of an image of 256x256. This is a lot of wasted memory.
My first suggestion is to buy Texture Packer (I'm in no way affiliated with them, it's just a great piece of software), which takes your images and makes them into a compressed PVR sprite sheets that contain several images in one texture.
PVR files are loaded directly into a texture, so they don't use double memory, and since they are sprite sheets, you have less wasted pixels.
My second suggestion is to, when loading your images, not do it all in the same tick of the runloop; Cocos uses a lot of autoreleases, and that memory is not cleared until the end of the tick, so instead of loading all images into memory in the same method at once, schedule that method to be called several times and load a new file every time.

iphone application crashes frequently with memory warning

I am developing an application for ipad which is dealing with image views, bitmap context, creating image from bitmap contet, video player, audio player, recording,picker views, table views and so on. The application is crashing with memory warning after some time. I am getting that the application exited with signal 9. But it is not entering in did receive memory warning delegate. then how can i know that it is recieving a memory warning.
How To Debug Memory Leaks with XCode and Instruments Tutorial

iPhone OpenGL ES app killed on iPad when using "2x" button

Hey, I got kind of a weird issue here.
I have an iPhone-only OpenGL ES app which runs fine on all iPhone and iPod touch models supported.
When running on the iPad, it runs on an iPhone-sized window as expected, and pressing the "2x" button once scales up the window to twice the size, as expected, and the app continues to run without problems.
But if the user taps the "2x" button 3 or 4 times quickly, the app is killed with the Program received signal: "0" message (which, from what I understand, means the OS killed my app for using too much memory, is that right?)
What I really do not understand is what in my app could possibly be using up more memory when the iPad scales the window up and down? As far as I know there's not even any way for my app to tell if and when the iPad is doing that. I don't know if the fact I'm using OpenGL ES is related or not, but that issue doesn't happen on any of the Cocoa Touch apps I have - though it also doesn't happen on the other two OpenGL ES apps I have. And this app does use more memory than any of the other ones.
Anyone ever had or even heard of this problem? Googling gave me nothing.
Since no one has posted with a direct answer (your situation might be a little vague), I have a suggestion for how to move forward and gather more information on what might be causing your problem.
Check out the Instruments in Xcode which can identify memory leaks:
Instruments User Guide
Or for an even friendlier introduction, here's a video that address performance issues, including memory leaks (and how to find them). iOS Performance Optimization Video
Just adding this so there's some kind of an answer here...
I never figured out what the hell was going on with the 2x button.
The way I fixed it back then was to optimize memory usage as much as I could, lazy-load all that I could and unload again when not in use.
Weird that it never complains about memory when running on any of the supported iPhone or iPod touch models, even the older ones, but it got killed on the iPad ONLY when pressing the 2x button repeatedly and quickly... I guess that's always gonna be a mystery to me.