Application Received memory warning - ios

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.

Related

High Memory usages and after that app crash ,when using Multiple image selection library in Swift

I am working on multiple image selection, here i used a library BRImagePicker inside project. the issue is that when i start using this libraries functionality it uses memory in high volume and after that app crash with this error message "Message from debugger: Terminated due to memory issue".also checkout the image of memory uses and help me to resolve this issue.
If you look at the BRPhotoPickerController.m file under Controller group, there is a line:
info.originalImage = [UIImage imageWithCGImage:[representation fullResolutionImage]];
A memory is allocated for each photo/video in the library.
This image or video is in its full resolution which means memory will get full within seconds after the picker is presented.
The approach is inappropriate since the original photos/videos are retained in memory.
Instead what you can do is to keep a reference like the media's URL and refer back to it later.
This thread may also be helpful.
Since you have not shared any code, I encourage you to read these articles to find the memory leak and/or zombie objects:
Find memory leaks in iOS apps with XCode Instruments
Identifying Memory Leaks using the Xcode Memory Graph Debugger
Xcode Instruments — Zombies
Update:
The original library is outdated, its last update was 4 years ago and I assume you are porting it to Swift. What Soroush pointed is the what I said earlier. You should not keep a lot of UIImages in memory, to fix it you need to both keep reference to assets, and unload invisible cells. To get an idea check this library https://github.com/tilltue/TLPhotoPicker .

'Termination due to memory pressure" in UIWebView

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

UIImagePickerController in source type Camera with allowsEditing to YES causes a “Terminated due to memory pressure” in iOS 7? [duplicate]

I am working on an iOS app in Xcode. Earlier I got it to start and run, up to a limited level of functionality. Then there were compilation failures claiming untouched boilerplate generated code had syntax errors. Copying the source code into a new project gets a different problem.
Right now, I can compile and start running, but it states before even the launch image shows up that the application was closed due to memory pressure. The total visual assets is around 272M, which could be optimized some without hurting graphical richness, and is so far the only area of the program expected to be large. (The assets may or may not be kept in memory; for instance every current loading image is populated and my code never accesses any loading image programmatically.) And it crashes before the loading image has itself loaded.
How can I address this memory issue? I may be able to slim down the way images are handled, but I suspect there is another root cause. Or is this excessive memory consumption?
Thanks,
Review the Performance Tuning section of Apple's iOS Programming documentation. Use Apple's Instruments application to determine how, when, and how much memory your app is using.
One approach you should consider is to disconnect the graphics resources from your application, and add them back one-by-one once you feel they meet the requirements and limitations of iOS.
Now, this part of my answer is opinion: it sounds like your app is a high risk for being rejected from the App Store, in case that is your intended destination for this app.

How can I address an app that started earlier, but is "Terminated due to Memory Pressure" now?

I am working on an iOS app in Xcode. Earlier I got it to start and run, up to a limited level of functionality. Then there were compilation failures claiming untouched boilerplate generated code had syntax errors. Copying the source code into a new project gets a different problem.
Right now, I can compile and start running, but it states before even the launch image shows up that the application was closed due to memory pressure. The total visual assets is around 272M, which could be optimized some without hurting graphical richness, and is so far the only area of the program expected to be large. (The assets may or may not be kept in memory; for instance every current loading image is populated and my code never accesses any loading image programmatically.) And it crashes before the loading image has itself loaded.
How can I address this memory issue? I may be able to slim down the way images are handled, but I suspect there is another root cause. Or is this excessive memory consumption?
Thanks,
Review the Performance Tuning section of Apple's iOS Programming documentation. Use Apple's Instruments application to determine how, when, and how much memory your app is using.
One approach you should consider is to disconnect the graphics resources from your application, and add them back one-by-one once you feel they meet the requirements and limitations of iOS.
Now, this part of my answer is opinion: it sounds like your app is a high risk for being rejected from the App Store, in case that is your intended destination for this app.

Core Text occasionally fails to produce results [iOS]

I’m helping out a company with a project for iOS, which is using Core Text. Some users of the app have reported that text is occasionally missing from within the app. It seems™ that this is somewhat memory related, because it’s solvable by shutting down the app along with background apps.
I made a few lines of code which simulates the use of the app – so the app “runs itself”, navigating between view controllers randomly, scrolling in text fields etc – to track if this issue occurs by normal use.
I’ve found some memory leaks related to the use of Core Text, but according to instruments the amount of memory lost is quite low. However, when the simulation has been running for about 20 minutes or so, the app is shut down by the os because of memory warnings.
I’m intending to fix this memory leaks, but my problem is that I will not be able to ensure that this fixes the main bug (missing text), since I cannot reproduce it myself.
So my final question is: have anyone experienced issues with missing text on iOS while using Core Text, which are due to leaked memory? Does it sound plausible? If so, is this related to only specific versions of iOS?
I appreciate any answers that can help me out!
UIViewControllers may implement didReceiveMemoryWarning that the system calls when your app is on low memory. Framework classes, as core text, are most likely do implement this and act accordingly to save memory. So it is possible that your core text object aims to help your app resolving the low-mem situation with freeing some of its resources that can even cause it to blank its contents. Fix first all memory leaks in your app.
On the other hand, all bugs are very difficult to correct if you can't reproduce them. If you suspect that the issue is due to low memory, try to simulate this yourself by allocating huge amount of memory in your application and hope that you can reproduce the erroneous behavior that way.

Resources