I am working on an iPad App that is built with Appcelerator Titanium Studio.
The app works great in simulator, but it crashes every now and then in the older models of iPad. So, I decided to see what's happening with the app by letting it run in simulator and using the XCode Instruments to see any leak.
As expected, there appears to be some leaks, this is what I can see in the report:
I have no idea what this thing is reporting back. How do you use this report to find the leak in your app? Has anyone got any experience with this?
memory leaks is all up to your code. There are no specific memory leaks you can just point to. However, there is a pretty good blogpost with some great basic rules you will have to follow to prevent memory leaks.
In case there are any memory leaks in Appcelerator's code, you will need to report it to their JIRA. However, my app for example is pretty big and I haven't encountered any so far. And if there are, they are tiny, as the memory usage is pretty consistent.
http://www.tidev.io/2014/03/27/memory-management/
If you want to locate the memory leak, try "Allocation" instrument.
You can follow this article.
Related
I am working on a news application based on xml parsing. For long time Facing application memory warning issue which crashes app, xcode shows memory usages more then 400MB and app getting crashed. Its a critical issue and i don't know how to rectify it.
Try your Application with Xcode - > Open Developer tool instrument--> memory allocation
It tell memory using by app & show issue or league
Use of large size of image
Did you creating objects and holding on to them with a strong reference for longer than you need to.
Need Code better answer.
I'm using wikitude for my augmented reality mobile app project. My problem is I dont know how to manage app memory before and after resume my app. This is my test result on my xcode5. Every time I resume my app during preview world, memory usage keep increasing.
Why?
You may have abandoned memory. Take a look at this thread as a good starting point. Tips for finding and debugging abandoned memory and heap growth
I got the answer, just update the latest wikitude SDK from github. This happen because of iOS7.
I have started receiving app termination due to memory pressures very recently (mostly with iOS 7). The app used to work very well on iOS 6.
The app is mostly uses a UIWebView to display a webpage. However for a few webpages it creates ever increasing Dirty memory with most of it due to Image IO and Performance tool data (see attached instruments screenshots). I am completely clueless as to where to dig next. Could someone guide me what should I do here onwards? In the second screenshot I see a sudden bump in the memory allocations. Is there a way to spot the process/part of the code which caused it?
EDIT One can reproduce these results in a simple demo kept at www.github.com/nikhiljjoshi/iosCrash (just change the site to www.nzz.ch).
Thanks in advance,
Nikhil
I'm trying to port the PhotoScrollerNetwork app to MonoTouch (a much improved version of the iOS 5 Apple PhotoScroller example), but the code is doing things that I'm unable to reproduce in MonoTouch.
https://github.com/dhoerl/PhotoScrollerNetwork
For example the memory management is very difficult to reproduce in MonoTouch, and without it it crashes. The author (dhoerl) wrote in the readme:
v2.0:
- iPad1 and iPhone3GS (with only 256M of memory) were getting killed with no OS warning. So, created an upper limit on cdisk cache usage,
and flush files (to free up memory) when the threshold is hit. Crashes
went away.
Porting the following class in MonoTouch is very complicated:
TiledImageBuilder.m
Maybe there is another, simpler way in MonoTouch to handle the above memory management tricks, due to his GC. Has anybody else tried to port the PhotoScrollerNetwork app and wanna share?
Any suggestion is appreciated,
Thanks.
I've just kind of been 'winging' it with long tests (for hours) with no crashes, and eyeballing my code for quite a while and made sure that everything looks pretty kosher as far as memory leaks. But should I be using instruments... is it mandatory to do this before uploading to app store?
I think that using Instruments is not only good practice, it's strongly recommended by the iOS development community as a whole. Even if your app seems to run fine, you still may have leaks in other use cases. Test your app thoroughly with Instruments before pushing to the App Store or you may be in for a lot of users on older generation devices complaining that the app crashes.
Some of the most crucial tools:
Leaks
Allocations
Time Profiler
Another suggestion alongside using Instruments is to compile with the -pedantic flag.
In addition to what Yuji said, turn on as many warnings as you can in the build settings, by default these are off.
No.
But at least run "Build & Analyze" in the XCode. It tells you what it can find about the memory leaks, just by analyzing the source code statically. It's basically eye-balling the code by the machine. It's infinitely better than doing that yourself. If there're any warnings issued, fix all of them. It's rare for the static analyzer to give false positives.
Also, running your app with Instruments is helpful to see how it really allocates memories. Sometimes it's fun, too.
I would never publish an app without running Instrument's leak tool.
I often miss a release somewhere. And even if I read the code 200 times I would not find it without Instruments.