hay all..
i hope every thing is good
im a new iphone developer and i did an application and when i finished i test it through allocation test in instrument and shocked from the results..it stole
very very big memory and i don't know what i must do..in the same time i release every variable i was used BUT the real problem was that the application load man images and contains custom cells and custom tables with custom navigation
please help me
It sounds like you're not releasing your objects after you're finished with them, or you're loading an unrealistic amount of images / data into a handheld device. It's pretty hard to help in this instance if we can't see your code.
I found the Stanford iTunes U course really helpful, and they go through the logistics of memory management really well. It's something you really need a good understanding of before/as your write your apps.
Related
Our apps are live on the app store.
I wish to recognise crashes of out of memory that some users are getting.
I understand there is no way to 100% recognise an out of memory crash.
Is there any way to recognise these crashes(with a pretty large probability) by doing some logic in the applicationDidReceiveMemoryWarning? (I am not talking about finding it in xcode during development time, i am talking about code that will recognise the out of memory crash from actual users and will log something to file)
While I was looking for any service or library that give me OOM tracking, I could only find this article from Facebook engineering:
https://code.facebook.com/posts/1146930688654547/reducing-fooms-in-the-facebook-ios-app/
The idea is to deduce the reason why the app needs to be launch, checking different aspects (like if the app was at background, if there is an app/OS update,...).
Discarding all the other possible reason that can force the previous app exit, you can know if the reason is a background out of memory or a foreground out of memory.
It would be nice to have a library that implements the Facebook article procedure. But nowadays I couldn't find any, probably there is some reason that make this difficult or may be impossible to add it as an sdk.
If anyone knows any service, please share it with everyone with a comment or a new answer.
Edit:
I have discovered this github (https://github.com/jflinter/JRFMemoryNoodler) with an implementation of the Facebook post procedure. I haven't tried yet, but we will deploy it in our apps to try it.
Look out for the applicationWillTerminate message in your app delegate. This is called if you app is terminated by the system (due to e.g. low memory), but not if the user leaves the app in the usual way by pressing the home key. Note: if your app is in the background and memory runs out, your app gets killed without any messages being sent to it.
YMMV, especially with older versions of iOS, and it's worth researching to ensure that the above is accurate.
The images at this blog post are quite informative (although slightly dated).
For more info, see How to know whether app is terminated by user or iOS (after 10min background)
Firstly Analyse your application by clicking on the Product at the top menu bar of your Xcode and click on Analyse section it will show you the number of leaks on in the application and can take you to the place where leaks occurred. This is how you can find the memory leak and rectify it.
Secondly it above does not worked then see to the view controller where crash occurred and check whether you have left any object to release.
Hope this might help you to resolve your problem.
I have nearly completed development on my app. The app is quitting at random points and the user interface freezes/loads very slowly. The app was made without ARC and I am just getting started with using Xcode Instruments to fix memory issues. I am considering moving the entire project to ARC, but don't know if that will help. Also, many of the processes that Instruments Allocations is picking up don't appear to be taking up too much memory.
I need to figure out the best way of improving the efficiency of my app. I have little knowledge in the area and have read a variety of tutorials on how to do certain things to improve efficiency, I just don't know where to start. Should I convert to ARC? Should I focus on using the Allocations/Leaks/Profile Instruments from within Xcode? I know its probably specific to my app, I just don't know where to begin. Any general advice would be great! Thank you all!
Changing to ARC is not got to help you, instead of this focus on Allocations/Leaks. Also try to optimize you code if doing something again and again. Also if you are using synchronous web-service call it also freezes the app.
If your app is not something very large, I advice you to move the project to ARC. Using ARC solves lots of developer mistakes in terms of memory.
When we have ARC, why not use it?
And the other thing is, if there are time taking processes. Perform them in a background thread.
I have run my app with instrument and i m getting a memory leak but i dont know at which point that memory leak is happening.
How will i know at which point memory is leaking.
Check out this article "Actually finding a memory management error with Instruments", from the big nerd ranch. Creating "heapshots" is a good way to start narrowing down the code parts that show no obvious memory management errors at first glance. But as ACB stated already, if a system library is leaking (rare case) there's not much you can do about it. But most of the time the memory issue is always in your apps' code somewhere! :-)
It says responsible library is quartzcore, and it is only 16 bytes. As long as it is not in the app and the OS is causing the same, you cant do much about this. I would recommend you to ignore this.
If you are facing issues, check the allocation tool -> Live bytes section and check if memory is shooting up when you are selecting a lot of images at the same time.
I can see from your screenshot that your app is already running in your device/simulator and you are trying to run it again with instrument, try to close your app completely from device and then start it again with instrument.
You can read more details about Xcode instrument from Apple.developer InstrumentsUserGuide
Also I have found another good tutorial about this in Raywenderlich blog
Another good documents is here
My team is developing an iPhone app which is very demanding in terms of memory. In order for a better user experience we are thinking of presenting a pop-up to the user upon startup stating the memory requirements and also a pop-up upon low memory.
Has anyone had a problem with such a solution, in terms of being rejected from the app store?
Thanks
It's simple, don't show any UIAlertView in a memory warning.
The user is not responsible to manage the memory for you. You need to take actions in memory pressure by releasing caches or other less important information.
iOS itself will release memory and kill other apps when it's needed.
To answer your question, I don't know if Apple reject apps for that reason, but they repeated more then once to not to do so.
IMHO, on iOS systems, specifying the memory requirements to the user is not relevant. Most smartphone users won't know the available memory and don't want to be bother by technical aspects. To be successful, your app need to be robust and that also means memory adaptive.
As far as i remember you can ask the system to give you the amount of free memory. Try to manage your memory consumption using it. There are many strategies. Common ones are to ask it periodically or ask it lazily only when you are going to load big data.
When you receive memory warning, try to reduce your memory footprint the more you can
I'm not sure anyone can say anything sensible about whether this behavior will be acceptable in the app store. I've never heard of an app trying it.
Philosophically, it seems counter to the HIG. Memory management is your job, not the user's. You could maybe give them some "usage information" on first launch asking them to close backgrounded apps when using this one, but putting a memory alert in front of the user just feels inappropriate.
Apple might not be happy with an alert, but possibly some kind of subtle ui graph showing available memory abstractly would be ok, and probably a nicer experience as the user could see how what they were doing affects memory.
Often, when a lot of applications were opened before my application I get "didReceiveMemoryWarning" and then, after a while iOS usually closes my application.
This is actually become a noticeable problem.
I have read so much so much consider to "didReceiveMemoryWarning" for the last few days. Including posts here. Unfortunately no solution found.
I know that I have to release any memory on this warning and bla-bla-bla…
The problem is that right after application start there is nothing to release. I have one UIViewControlled in memory with AdMob 4.0.2 banner and one own container that serves application data - which is a few records in NSMuttableArray.
Right after start my application takes 1.3 Mb – according to Instruments and at this initial state my application was not working and I definately know no memory leaks.
What is wrong?
I see that some of the heavy games can be started with no problems, but in the same time my application in this case gets "didReceiveMemoryWarning" and is closed.
Is there a way work in normal way in this situation.
Is there some tricks?
Thanks in advance for your suggestions.
Where are you allocating the NSMUtableArray? I think it's being allocated often! (Just a probability...) Do you releasing the NSMutableArray?