why is launchd killing my app, that only uses 2 MB in RAM?
I am developing an app on iPod touch, that uses the camera, displays a preview and takes pictures (all that through an AVCaptureSession). What I don't understand is that my app sometimes gets killed by launchd after a memory warning...although it uses no more than 2 MB in RAM (see attached screenshot). The console tells me
Aug 16 15:16:35 Wiggler[109] <Warning>: Received memory warning. Level=1
...
Aug 16 15:16:58 unknown com.apple.launchd[1] <Notice>: (UIKitApplication:com.tMyCompany.Wiggler[0xd83d]) Exited: Killed: 9
On the other hand, I can successfully run other apps that use tons of RAM (more than 100 MB) without any crash nor memory warning.
What is wrong with my app ? What am I missing ? Is it a开发者_JAVA百科 bug or a memory leak within the AVFoundation (the framwork that provides AVCaptureSessions) ? I can't see why my app is killed while it uses so little memory...
Thanks for your help.
You almost surely are using more memory that what Allocations is showing you.
From your snapshot, it seems to me that you are not using the VM Tracker tool. Select the "snapshot automatically" option of the VM Tracker and then check both the "dirty" and "resident" size.
This will give you a more "global" view of your app memory usage. It will not help you to fix your allocation problems, if any, anyway, but at least it could explain why the memory warnings get in.
For an excellent explanation of what "dirty" and "resident" memory is, look at this from S.O.
Try configuring your AVCaptureSession for smaller captures and see what effect that has on dirty memory use. The GC can't collect memory that is in use (as part of the capture or preview, etc.)
精彩评论