Apple maps memory footprint - ios

Did anyone had or have problems with the memory footprint (Live Bytes) when using the new Apple maps in an iPad application?
I tested my iPad app with Instruments and it seems the memory allocation jumps to over 70MB when displaying the map (and even 120MB when start zooming) -- while on iOS 5.1 (using Google Maps) the memory footprint is less than 4MB.
Or does anyone have a solution to this issue (reducing the memory footprint when using Apple maps)?
Thanks.

As I commented above, this became an issue required me to bang my head against a wall for some time. The straight answer is, yes this is an issue Apple accepts to be exists but they have some good excuses for that such as newer hardware devices should be able to handle this memory consumption without much pain. However, some people have already logged issues in their system, so there is nothing we can do until they fix it and release a patch.

Related

Jetsam kills WebGL application on iOS

I am currently struggling with memory management inside a webgl application on the web, on iOS only.
I keep getting the following error message :
Application 'UIKitApplication:com.apple.Preferences[0xa7c1]' was killed by jetsam.
I understand that Jetsam is the system process responsible for memory management, but the crash occurs while the browser uses around 25% of the device's RAM, which is not that high. I don't have any other open application while running my webGL content. What I don't understand is what Taun Chapman said :
Jetsam monitors memory use and kills applications which are not good memory citizens. A good memory citizen is an application which is willing to give back memory when asked and does not keep asking for more memory.
Well, the app needs more memory in a short time (when unzipping 3D models using workers), I can't continue my app without it! And it crashed at these particular times.
Moreover, I think I have some memory leaks in my app, according to Chrome DevTools I am currently trying to fix. But the browser itself seems to have some leaks too. Thus, fixing mine will just delay the inevitable.
I know the following question is odd, or inappropriate, but do you know if the jetsam "limit" can be increased ? Or if you can add an exception on the currently running WebGL app ?
For your information, I use the Three.js WebGL library and the zip.js library to compress my 3D models.
Yes, I've already read the following question : Why does simple website crash on mobile (iOS Safari and Chrome, at least)?, but the problem does not come from my CSS.
The 10.3.2 version of iOS (released the 15th of May) made Jetsam less aggressive, or at least, the memory is better handled.
https://support.apple.com/en-gb/HT207798

Wikitude - Bad memory management / memory leaks

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.

Why iOS terminates background apps instead of handling lack of RAM differently?

All over this document Apple mention iOS terminates apps under certain conditions, and the most popular reason seems to be freeing up some RAM. And that causes issues for apps that do not implement state restoration - some of the content user is working on and stepped away from for a moment could be easily erased. There's even a 16 page thread on Apple forums where users complaining about that.
Is anyone aware why iOS actually terminates apps instead of moving memory occupied by them onto disc/swap?
Does termination actually provide considerable performance improvement compared to other means?
What you are describing is paging, or more accurately, page swapping. The iOS version of BSD Unix does not perform paging, for lots of reasons. Here are a few educated guesses:
It's too power-hungry for a mobile device.
Flash memory can't handle the churn involved in paging. Flash memory has a limited number of lifetime write cycles per storage location, and paging would chew through the life of the flash chip.
As the other poster pointed out, swapping to disk would use up available disk space, which is also limited. Not a problem when you have a 500 GB drive, but it is a big problem on a device with only 16 GB of HD and 1 GB of RAM.
You're not going to get an answer for this question here. Apple don't explain the inner workings of iOS and anything else is going to be guesswork.
Here's my guesswork:
iOS is a heavily resource constrained environment. Memory is limited but so is disk space - a 16GB iPhone has 1GB of RAM, so "swapping to disk" isn't really something that can be freely applied. When do you stop? How do you know this isn't already being done, but there is only a limited swap in place?
The primary goal of iOS has always been to prioritise responsiveness of the foreground app. Anything other than warning, then closing background apps would probably impact this too much. If there are 15 apps in the background then imagine the processor load on nicely swapping the memory out for each process?
Because the RAM that was saved onto the disc would be much slower. It's better to cut the program then having it run poorly. I think that answered both questions.
Thanks everybody for responses. I had to do some research to answer this question, though. So I was looking for more understanding that led into "app termination" decisions. I know, there are some smart people working in Apple, but for me it always help to understand the reason something is build "this way" rather then just following it.
It turned down into these 2 questions
Why iOS terminates apps instead of freeing memory by paging out (swapping)?
Does termination provide considerable performance win?
To understand that I dug a bit into the history of iPhone. There's a video that was accessible on iTunes, unfortunately the link does not work anymore. Anyways, the video was introducing the very first version of multitasking on iPhone 3G (or was it 3GS? Not sure which device starts to support multitasking).
Nowadays iPhone devices are quite advanced in terms of hardware. Those are actually more advanced then some desktops we had 7-10 years ago, which already have had incorporated swapping long ago. But if we look for first iPhone releases, those are not that much advanced in terms of hardware. iPhone 3G is 620 Mhz ARM and 128 RAM. iPod touch 1gen had 400mhz ARM. And multitasking was supposed to run on all the devices of that time.
If we take a look at iOS, it was always has the smoothness of animations in priority; taking look at hardware I see it would be challenging to have both snappy and responsive device along with processing swapping background applications memory, so it seems very logical and very fair to terminate apps. A year or two later Apple provided APIs to facilitate implementation state restoration.
But if we look at the current iPhones and iPads - they do have enough power in order not to terminate apps and just drop their memory on disk without any drop downs in animations and foreground app performance. Why not add that on latest devices? I assume this is common for the software industry; new features often prioritised higher then improvements on existing workflows; Apple has been releasing MobileMe, support for Retina displays, AutoLayout, iCloud - so I can understand that cool improvements of already existing features has been sacrificed.
The issue with apps that don't provide state restoration is easily solved by providing state restoration.
Just killing apps when the system runs out of memory is a huge performance gain. Consider that the system usually runs out of memory when you launch another app, and any action that is done instead of killing old apps would have to be done before launching the new app; that's about the most performance critical point in time.
And for at least five years you have been told that when your app goes to the background, you should store just enough state to come back to that state if your app is restarted.

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/

How to tell users how much memory your iOS application needs

I'm developing an iOS application which (like any other) requires a certain amount of free memory to run correctly. In my case - at least 4MB, I cannot use any less than that. It's a fairly small amount, but a few times (on my device at least) I got only 2MB free and the program crashed. What do you think is the best way to tell users how much memory you need. I know the code to get the currently available memory, but even if I tell the user (like in a UIAlertView when the user starts the program) that he is running low, what can I suggest him to do to free more memory (except turning off and on the device). Any ideas?
On older devices you can't really rely on getting more than 8MB. 4MB is a great target, and if through your profiling you've determined that's all you need, you should be fine.
However, I think the concept here is that if you receive memory warnings you wouldn't bother the user with those types of things. I would find it pretty annoying myself. It would be better to limit your app's activity or throttle back whatever you are doing that is so memory intensive.
On which kinds of iPhone devices your app is being tested? I suppose that the iOS has to do its job well to free enough memory for you or kill alll background app so it can have more memory

Resources