Application crashing and show error "malloc: can't allocate region" - swift

I am creating an application with lots of images. By Api I am getting those images and then after I am showing those images in collection view.
For few minutes application is working fine but after that it crashed and showing error
"malloc: can't allocate region"
:*** mach_vm_map(size=3145728, flags: 100) failed (error code=3)
Kindly help me out. Thanks

I think it's due to ran out of memory
Check the memory usage of the app.

Related

malloc: Heap corruption detected, free list is damaged

My app is running fine till iOS 12. After updating my iOS version to iOS 13 beta, the app is crashing in random places and with the same error. Following is the Xcode console.
MyApp(618,0x10cebd800) malloc: Heap corruption detected, free list is damaged at 0x28ea33ff0
*** Incorrect guard value: 5276115984
MyApp(618,0x10cebd800) malloc: *** set a breakpoint in malloc_error_break to debug
Any lead to debug/solve this will be appreciated. Thanks in advance.
As you stated, your app crashes in random places, I would also add in random times, this might be a clear sign of a retain cycle (could be because you forgot to capture a weak self inside a closure) somewhere in your code that led the heap to get saturated. At this point the system will certainly decide to terminate you app process and free up memory for other tasks.
In order to see this more clearly, try to profile your app (launch it with Instruments) with the Leaks profiling template, play around with the app and try to reproduce the scenario that led to the crash until it gets stopped (terminated), at this point Instruments will provide you with more details.

Receiving memory warning in my iphone application.

I am using ios camera and upload the image to our server when i cross more then 40 images i got memory warning, also my application quits automatically, i cant to solve this problem anybody help me how to resolve this issue.
Thanks in advance.
check out these links:
I received memory warning and my app crashed. Does it kill autorelease objects?
How to catch warning in app for Crash reporting: Received Memory Warning
Memory warning and crash: how to handle it
http://www.neglectedpotential.com/2012/04/testing-memory-warnings-in-ios-applications/

ios - memory warning and crashes

in my app i have a UIWebView and in that web view i am loading some text and images. I am getting those datas by parsing from an rss feed. When large datas get loaded my app get crashed saying that memory warning. How to avoid this memory warning issues in my app
Sorry, but there's only one real answer to this: use less memory.
When you get the memory warning you should clear out any caches or temporary data that can be recalculated. As you've found, if you don't do that iOS will kill your app.

memory leak - application exited with signal 9

I have an application which is dealing with many data structures, uiimageviews, videos, creating bit map context and so on. Every time the application is crashing on its continuous usage for a long time. The application is crashing with the memory warning --> Application exited abnormally with signal 9. What may be its reason. What does signal 9 means.
I think this is due to the memory issue. Your app is using lot of memory due that is app is killed..
Check out this posting
http://lists.apple.com/archives/xcode-users/2011/Mar/msg00837.html
It sounds like it might be related.
It can also be a privacy/permission issue.
We forgot to add NSCameraUsageDescription and UILaunchStoryboardName to Info.plist file and our app crashed with error Message from debugger: Terminated due to signal 9
After adding the following lines to Info.plist the app sopped crashing.
<key>NSCameraUsageDescription</key>
<string>The app would like to let you make a picture.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>The app would like to let you choose an item from your Photos.</string>

Iphone main thread crashes but app still running - "program received signal 0"

so when i'm running my app using XCode and I can see that my app gets "program received signal 0".
However , the background thread are still running. why is that ?
Second, I can't seem to find any solution to this problem.
I assumed it might be memory leak, but I see nothing special using LEAKS (instrument).
When I run the app on the device(without XCode) and then try to see the device crash inside the organizer, most of the times there is no log (I guess maybe because the app is still running and only the main thread crashed) and while there is a log, my app function are only hex addresses without names.
What other options do I have to solve this issues ?
Thanks!!
I've found that sometimes these errors are caused by trying to access deallocated memory. One great tool to debug these issues is NSZombieEnabled. Here's a link to a good explanation of how to use NSZombieEnabled: CocoaDev: NSZombieEnabled