ipad application memory warning when using little memory - ipad

I am running an ipad application compiled for release and am seing memory warnings once in a while.
When I run the app on the device and connect Instruments, I see that the app never passes 40MB of real memory, but the warnings are still occurring.
What might be causing this? How can I better track down the reason?

40 MB of real memory is a lot, for an iPad. Even if it was not, the system will deliver the low-memory warning to you from time to time anyway, without your application being the main culprit. Tracking down precise memory usage in your application is sometimes hard, I’d suggest to spend some time with the Object Allocation instrument while working with the app. If you are not getting killed and you are sure that you do not leak the memory, you can also simply ignore the warnings.

40MB is high for the iPad considering it only has 256MB to start with. There could be other applications holding on to memory which will be killed off as more memory is needed. Just make sure you aren't leaking anything. Also use NSAutoReleasePools where applicable to reduce peak memory usage in memory intensive loops.

Related

Memory issue warning in my app, but app doesn't consume a lot memory

I get an lowmemory waring in my app and then it crashes.
But when I look into the memory consumption, I can't recognize any memory limits of my app. I also can't see any crashlogs on my device.
Does someone has a hint for me ?
in my didReceiveMemoryWarning I set a breakpoint.
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
print("memory low received !!!");
}
then i checked the memory and it looks like following:
UPDATE
I know already what are memory leaks, so it doesn't help to give me hints in general. I am interested to know if I read the memory usage correctly and if we can see that the problem is the app or the general invironment.
I run my app several times and do always the same actions (automated by code) and from 5 times it crashes one time.
The low memory warning can be caused for a lot of reasons. If you see that your application is not using too much memory and if does not crash due to the memory usage then there is no issue.
But generally I believe 3 things can trigger the warning:
Your application is using too much memory (does not seem to be the case)
You have other applications opened that consume most of your memory which will be killed by the OS on warning (probably your case)
Your application memory consumption keeps jumping up and down which should be avoided and the OS may kill your app in this situation (I hope you are not doing something that could produce this)

How to determine how much memory allocated by my app in iphone

I am having some trouble around memory leaks in my app.
I just wanted to know that whether it is possible to identify how much memory allocated by my app on heap so that i can reduce my resources accordingly.
I know that system gives low memory warnings & i can clean up my data there but even if sometimes it wont happen.
If i get to know that my app is reaching maximum memory & remaining size on heap so i could be better to reduce my resources.
Thanks in advance....
Use Instruments. Command-I in XCode to profile your app in Instruments.
Yes of course, I would recommend the instrument's tool "Leaks". It lets you know how much memory allocates your app, and if there are leaks it tells you what they are, when and were it was allocated (and obviously not released).
Here is a nice guide I used some time ago.
http://www.cimgf.com/2008/04/02/cocoa-tutorial-fixing-memory-leaks-with-instruments/

Retrieve memory iPad information in iOS app

Is there a way to retrieve information about the memory of the ipad during running?
For example, i would like to print in the console the use of memory at t instant.
Thanks
You should instrument this instead of trying to print a number. That number is not really useful. What you care about is your application's dirty memory footprint for memory pressure on the device and how much code/mapped ro mem you're evicting to see if you're essentially thrashing and causing performance problems due to memory pressure.
The other info you can get, like device inboard memory and how many pages your app has allocated are not useful because you don't know how much of that memory is wired to other devices or the kernel and you don't know how many of your allocated pages are faults at that point.

iOS, check if the app crashes because of lack of memory

How can I make sure that reason of crashes is lack of memory?
Is there anything specific in crash log?
Maybe I have to use some tools or libraries?
UPDATE: my app uses lot of memory and receives memory warnings. It's very difficult to reduce memory usage. It crashes because of memory warnings time to time. But I want to make sure that it doesn't crash because of other reasons.
So how can I check the reason of app crash (it receives lots of memory warnings every time)
UPDATE2: Application has lots of 3D graphics and complex UI that takes lots of memory for textures. Customer doesn't want to make any kind of "loading..." pauses. If I unload invisible textures in background I can't get smooth animations.
So I just need to detect is there any crash reasons except memory.
At least you could implement the method
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application
in your app delegate, and put a log to see if this indeed you are going through it before crashing.
Product -> Profile -> leak is a possible method to check memory leak. Allocations will show the total memory being used, and leaks will show leaks due to not releasing.
how-to-debug-memory-leaks-with-xcode-and-instruments-tutorial
that is a useful tutorial
You can use Apple's Instruments Tool to profile various things such as memory usage. This tool is bundled together with Xcode.

Memory issues under ARC (app crashing with small leak and 2MB of allocations)

So I'm trying to get my first app ready to submit to the app store, and I'm at the profiling/analysis stage of it. My app is crashing, and I have some questions I can't seem to dig up answers to.
I've been running my app through Instruments checking allocations and leaks, and it's been crashing fairly regularly. The weird part is that allocations says my total is only 2-3MB, and while I do have a leak, Instruments shows only an occasional ~300 bytes (about once every 2-3 minutes with heavy use), but I'm still getting low memory errors and signal:9 killed:9 when it crashes.
Are there things that Allocations isn't showing me? (i.e. storyboard initialized views, or memory allocated on background threads)
How significant a problem is my small leak? I'm obviously working to stamp it out, but is it likely that this is just a red herring? Or could it be the cause of my crashes?
I did some HeapShot analysis (credit goes to bbum for the awesome walkthrough) and found two instances where I WAS in fact leaking memory, just in a way that wasn't being captured by the Leaks instrument.
App's been running steadily through a few more days of testing, so it seems alright now.

Resources