There are a few things that I don't understand about iOS memory management.
I wanted to know how much memory typically an iPhone app takes while running on device (Is there any fix number like 10MB?)
If an app includes lot of large images what is the impact on the memory? Do they only impact memory when they are loaded?
How does iOS manage the memory when there are multiple apps running?
Please help me understand these concepts.
There isn't a stated or fixed amount of memory available to apps on iOS devices.
That said, there are game apps that are reported to use over 55MB of memory, however the OS is also reported to kill these games some significant percentage of the time if not run right after a device reset.
If you use 22MB of memory or less, the OS could still kill your app because there wasn't enough available memory, but it would also have to kill a massive percentage of other apps in the app store, so you would be in very good company.
When any app (foreground or background) requests enough memory to start depleting the memory pool sufficiently, memory warnings are sent to other apps. If the memory pool gets small enough, apps are killed, including possibly the foreground app if it's a big memory hog.
Q1) There isn't a fixed value, of course. Every application (and application instance) will use a different amount of memory depending on it's task(s). There is a maximum, however. Reaching this maximum will trigger a memory warning and the OS may kill it.
Q2) Images: Depends on how many you are showing at once, or through animations.
Q3) The application in the foreground gets the most memory allocated to it. Applications in the background can request memory to perform background tasks.
Good article for best practices:
http://inessential.com/2010/06/28/how_i_manage_memory
Related
Do you have any ideas for finding out why the phone's battery will be too hot?
I implement the PWA site with React and Firebase (firestore). And I'm running into the above problem. To find out about it, I watch the following tools.
Chrome's memory tab
performance's memory tab
Please tell me other ways to find out why the battery is hot.
There are many reasons why your phone runs hot and we are unable to deduce which is the main cause with the data provided. But, some reasons why your phone runs hot may be old hardware, deteriorated battery, the cpu consumption of your page is too high, there is a lot of data transfers happening in the background and many more. Sometimes it might not be even your page that is causing your phone to run hot.
I've built an electron 8 app. It does some Computer Vision using tensorflow.js--modules are prebuilt by Google, so nothing custom on my end. Typically the GPU process floats around 200-300mb RAM. However somewhat randomly it'll go above 1gb and hang there and I can't figure out why. The application runs in the background and only does processing randomly, so it's visually painful to have it consume so much memory when it's doing nothing.
Any ideas how I could troubleshoot/debug the GPU process memory usage?
Any ideas on ways to force the GPU process to free up memory it's holding on to?
I've tried disabling hardware acceleration--and while yes that fixes the memory issue, the CPU goes sky high when the app does the Computer Vision work. I'd prefer it to hog more memory than impact the CPU that much.
I am developing a UWP app which could have a fair amount of memory pressure.
I want to adapt the memory usage, so that I don't get short of it when I need.
Is there a way inside the App (I am thinking mainly about an event that I can register from my App or MainPage, or something similar...) to get notified when i.e. the memory usage of the App reached 90% of the allowed value for my App (e.g. in tablets) or 90% of the available memory of the overall system?
Thank you!
Your best bet for this is the MemoryManager.AppMemoryUsageIncreased event:
https://learn.microsoft.com/en-us/uwp/api/windows.system.memorymanager.appmemoryusageincreased
If this isn't granular enough for your purpose, you could monitor MemoryManager.AppMemoryUsage property yourself, relative to the MemoryManager.AppMemoryUsageLimit property
https://learn.microsoft.com/en-us/uwp/api/windows.system.memorymanager.appmemoryusage
https://learn.microsoft.com/en-us/uwp/api/windows.system.memorymanager.appmemoryusagelimit
I am writing a Windows based application that uses the OpenCV library for image processing. This is a multi-threaded application and each thread loads an image and processes it. My problem is that when the images are huge, the memory consumption becomes very high and the application crashes.
I want to be able to track the amount of memory my app is using(from within the app) and dynamically restrict the number of threads being created. Is there a way in Windows to track how much of permitted memory the app is using( and how much more I will be allowed).
I am using VC++( VS2010 on Windows 7).
I did look at some questions such as this and this, but could not find any that allows tracking from within the app itself. Is this possible? Any guidelines would be helpful.
Don't know if this will have any serious impact on the memory consumption, but it's worth of checking if you haven't already done it.
When creating a thread, if you don't specify the stack size, the system will use the same amount as for the main thread. This could be 1MB. You probably don't need large stack, so try passing 32k, 64k, 128k...
I, and a few other of my Android app users, run a Galaxy Nexus. Most of us find the app to be blazing fast, but a couple are reporting that it is unusably slow also on a Galaxy Nexus. I'm shocked to hear them tell me that the buttons, scrolling, etc. are all slow. The main view of the app is a ListView containing many images, textviews, etc. In fact, you can check out the app for free on Google Play if you feel like digging deeper. I'm trying to compile a checklist of what might cause this issue.
Here's what I have so far:
Low memory
Low disk space
Uncaught errors
Rooted device (?)
Any other ideas?
More importantly, is there any way to detect (or even adjust for!) potential problems?
Some other things:
CPU Usage (monitor via an app like WatchDog (it's free)); it mightn't be your app that's the problem
Android version.
Connection speed (Wi-Fi vs 4G vs 3G vs 1x)
Carrier (since they like to flash their own custom ROMs)
AFAIK Android version and connection speed are exposed by the SDK, not sure about CPU usage or carrier.
Of the errors you listed, I think that low memory would be the most likely factor.
If I were you, I'd create a function that would collect as much of this information as possible and send it to your email (or someplace). Then, have some way for the user to call this function (e.g. in the settings menu or someplace like that).
Granted this is all just intuition as an end-user, I have little experience debugging deployed apps from the coding side.