【发布时间】:2011-08-24 06:00:51
【问题描述】:
这个问题困扰了我很久。我的应用程序运行占用了大约 2.74MB 的内存。没关系。但是当它创建一个 UIWebView 时,它会上升到大约 5.87MB 并继续崩溃。这些是在我的第一代 iPad 上运行时在 Instruments 中的 Live Bytes 下给出的值。
我找不到崩溃日志。以下来自控制台:
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 的调用,将自动释放的内容更改为分配/释放。但我无法弄清楚为什么会发生这种情况,这让我发疯。
感谢您的帮助!
【问题讨论】:
-
您的应用似乎没有崩溃,它正在被终止以释放内存。发生这种情况时它是否在前台?
-
是的,它一直在前台。该应用程序打开,使用 2.74MB,然后我点击打开一个 UIWebView,它将使用量增加到 5.87MB,然后在几秒钟内被杀死。它发生在任何正在加载的模糊复杂的网页上。
-
我认为 5.87mb 没什么大不了的。我的猜测是视图控制器正在被卸载,这会导致其他问题。在视图控制器中尝试 NSLogs 或调试 viewDidUnload。
-
实际上没有使用任何视图控制器。它几乎只是一个带有 UITableView、UIView 和 UIWebView 的 UIView。
-
会不会与 NSArray 有 50 个左右的 CTFrameRefs 结合 UIWebView 导致系统用完分配给图形的内存?
标签: iphone objective-c ios ipad memory-management