iOS低内存崩溃,但内存使用率非常低 [英] iOS Low Memory Crash, but very low memory usage
问题描述
很长一段时间这让我烦恼。我的应用程序运行占用大约2.74MB的内存。没关系。但是当它创建一个UIWebView时,它会上升到大约5.87MB并继续崩溃。这些是在我的第一代iPad上运行时在仪器中的Live Bytes下给出的值。
This has been annoying me for a long time. My app runs taking up about 2.74MB of memory. That's fine. But then when it creates a UIWebView it goes up to around 5.87MB and proceeds to crash. Those are the values given under Live Bytes in Instruments while running on my 1st gen iPad.
我找不到崩溃日志。以下内容来自控制台:
There is no crash log that I can find. The following is from the console:
MyApp[1205] <Warning>: Received memory warning. Level=1
MyApp[1205] <Warning>: applicationDidReceiveMemoryWarning
SpringBoard[30] <Warning>: Received memory warning. Level=1
MobileMail[1199] <Warning>: Received memory warning. Level=1
configd[26] <Notice>: jetsam: kernel memory event (95), free: 428, active: 1853, inactive: 1011, purgeable: 338, wired: 15122
configd[26] <Notice>: jetsam: kernel termination snapshot being created
com.apple.launchd[1] <Notice>: (UIKitApplication:com.apple.mobilemail[0x8966]) Exited: Killed: 9
com.apple.launchd[1] <Notice>: (UIKitApplication:com.MyApp.MyApp[0xdd4f]) Exited: Killed: 9
SpringBoard[30] <Warning>: Application 'Mail' exited abnormally with signal 9: Killed: 9
kernel[0] <Debug>: launchd[1207] Builtin profile: MobileMail (sandbox)
SpringBoard[30] <Warning>: Application 'MyApp' exited abnormally with signal 9: Killed: 9
configd[26] <Debug>: CaptiveNetworkSupport:UIAllowedNotifyCallback:70 uiallowed: false
ReportCrash[1206] <Error>: libMobileGestalt loadBasebandMobileEquipmentInfo: CommCenter error: 1:45
ReportCrash[1206] <Error>: libMobileGestalt copyInternationalMobileEquipmentIdentity: Could not get mobile equipment info dictionary
ReportCrash[1206] <Error>: Saved crashreport to /Library/Logs/CrashReporter/LowMemory-2011-05-12-160645.plist using uid: 0 gid: 0, synthetic_euid: 0 egid: 0
我已经删除了对imageNamed的所有调用,将自动释放的内容更改为alloc /发布。但我无法弄清楚为什么会发生这种情况,这让我感到疯狂。
I have removed all calls to imageNamed, changed autoreleased stuff to alloc/release. But I cannot work out why this is happening and it's driving me insane.
感谢您的帮助!
推荐答案
您几乎肯定在使用比你想象的更多的记忆。
You are almost certainly using a lot more memory than you think.
你要做什么才能看到你的应用真正使用的东西并不明显,但是一旦你做了几次,你请记住。
It's not obvious what you have to do to see what your app is really using, but once you do it a couple times, you'll remember.
- 使用Allocations性能工具运行。
- 点击VM Tracker行在分配下(在屏幕截图中)
- 点击自动快照
然后你会看到你的脏内存(我的屏幕截图目前是20.34MB)。
Then you will see your Dirty memory (currently 20.34MB in my screenshot).
这可以让你更好地了解你的应用程序退出的原因。你可能会发生一些大的泄漏事件。
This should give you a much better picture of why your app is getting quit. You probably hav some large leaking happening.
祝你好运!
这篇关于iOS低内存崩溃,但内存使用率非常低的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!