I developed an app that communicates with multiple devices by socket connection. Once the app is running it searches for the devices and connects with them. Each connection is ran in a thread. I checked the memory when the app is running, it rises about 20+ Mb. I don't know if this is really high for an app, but the energy impact is very high.
I tried using the tools to check whether I am using too much heap memory or I have a lot of leaks. Well, the result is I do have a lot of leaks, but does this lead to very high energy impact? or there could be other reasons?
In some iPhones, the phone will overheat after running my app for awhile. Especially iPhone 7.
Related
I have an app that is available on AppStore, it is a biological recognition app, so there's lots of C/C++ code in this app, and it goes well on iOS7 to iOS9, but when I tested in on iOS10, it always crashed dued to memory issue after several trials, I tried the Allocation instrument, not much leaks.
When I tested it in xCode, I found something interesting(I already shut down every app that run background), the memory usage of other process increased dramatically on iOS 10.
iOS10_iPhone5s
But it didn't increase so much on iOS9:
iOS10_iPhone5
So I have several questions here:
what's in other processes, it should be the apps that run background, but why the memory usage increased even I shut down all the other apps?
why I can only reproduce this issue on iOS10? and it runs well on iOS7-iOS9.
Can anybody help me? thank you.
"Other Processes" includes literally every other program that is currently running on your Mac. That number has nothing to do with the simulator. It does not measure processes that run in the simulator.
If you run iOS Simulator Xcode shows memory stats from your Mac.
Please refer this as well
Running out of memory in 'Other Processes' in Usage Comparion Xcode iOS9
iOS Memory Management -- Other Processes RAM Increasing
I'm getting out of memory crashes with a Cordova app on an iPhone 4S running iOS 7. I am try to implement an infinite scrolling list and I start seeing memory pressure and hiccups when prepending to the list (appending seems fine). When I run the Allocations widget in Instruments, I see a crash when there are 20 MB of allocated Live Bytes.
Here's the interesting part: This Cordova app is replacing a native one that has been available on the App Store for a number of years without issue. When I profile the native app, I see the memory go above 20 MB, but the app doesn't suffer from any memory-related crashes.
Why does the native app continue to run fine after surpassing 20 MB of Live Bytes while the Cordova app terminates? Does the Allocations widget not properly take into account the memory usage of the UIWebView Cordova uses? Or is there some other resource not being taken into account?
After more investigation
I ran the tests again using the Memory Monitor. Here are the results of the Cordova app:
And the native app:
I think this brings us closer to the answer. Both apps have similar Real Memory usage, but the Virtual Memory is dramatically higher in the Cordova app. I'm not sure what causes this and why this isn't reflected in the Allocations widget.
As best as I can tell, the Allocation widget is inaccurate for total memory usage and it was best to just use the Real Memory + Virtual Memory numbers from the Memory Monitor widget. This is pretty much the only option when developing Cordova apps since the UIWebView is a black box and difficult to profile.
I see a lot of low memory warnings being issued when running my application in Instruments. The total memory allocation does not exceed 5.02 MB. What could be the reason? I checked the Leak Instrument as well. There I see leaks, but due to some framework classes. None are beacause of my project classes. How to trace the root cause?
Please see attached snapshots of Leaks & Allocation instruments:
Some versions of the OS on some iOS devices will send memory warnings to the foreground app when a background app (Mail, Messages, Music player, etc.) needs sufficiently more memory. This has nothing to do with the amount of memory your app is using. If your app is not using a lot of memory (well under 10MB), it can usually ignore these memory warnings, as the OS will usually kill a background app that is using more memory than your app instead of your app (no guarantee though, whether your app frees memory or not!).
If you want to avoid all these memory warnings when testing, put the device in Airplane mode and force quit all the background-aware apps in the multi-tasking bar before running your app.
I am developing for the iOS and checking my app with IPhone and IPad.
I receive many memory warnings (didReceiveMemoryWarning is called) but have no idea why.
My app is using ~35MB in the peak points, and 4-5 MB when it the lowest point.
I tried to find leaks using 'instruments' but could not find any critical issues.
Is there a good way to find out why the system sends memory warnings?
Memory warning is to be expected in an iOS app. It doesn't have to be because of your app. Other apps are still in memory even if the apps are suspended. The OS will do memory management by sending memory warning and kill apps when necessary. As long as you're using reasonable amount of memory (with little to no memory leak) and handle didReceiveMemoryWarning properly, you'll be fine.
Also, when your app is in suspended mode, if your app is using little memory footprint, your app will more likely to survive killing process. As app with larger memory footprint will be terminated first.
I also found that "Product -> Analyze" (Shift+Command+B) can help you sort out some code issues before you start using Leaks. With the introduction of ARC this became less useful though.
I'm working on an app that works fine on all devices (all the way back to 3.0 and the first iPhone in fact). If I profile useing'Activity Monitor' instrument (Memory Monitor) tool the app runs fine, with no crashes, and no excessive memory usage reported.
However, when I run it in Profile mode with the 'Allocations / leaks' tool selected, on iPad 1, I get lots of memory warnings in quick succession followed by a crash (about a second after all the memory warnings fire off, it crashes), but this ONLY happens when running with the allocations / leaks monitor enabled.
I need to find out why this is happening. Is there a compatibility issue with iPads and the latest version of instruments and that specific tool? Does it take up an excessive portion of memory?
Thanks in advance,
Stew