Max*_*Max 35 iphone memory-management objective-c ipad ios
这让我很烦恼很久了.我的应用程序运行占用大约2.74MB的内存.没关系.但是当它创建一个UIWebView时,它上升到大约5.87MB并且继续崩溃.这些是在我的第一代iPad上运行时在Live Bytes in Instruments下给出的值.
我找不到崩溃日志.以下内容来自控制台:
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
Run Code Online (Sandbox Code Playgroud)
我删除了对imageNamed的所有调用,将自动释放的内容更改为alloc/release.但我无法理解为什么会发生这种情况,这让我感到疯狂.
谢谢你的帮助!
Pau*_*eau 51
你几乎肯定会使用比你想象的更多的内存.
你必须要做的就是看你的应用程序真正使用的内容并不明显,但是一旦你做了几次,你就会记得.
然后你会看到你的脏内存(我的屏幕截图目前为20.34MB).
这可以让您更好地了解您的应用程序退出的原因.你可能会发生一些大的泄漏事件.
祝好运!

fsa*_*int 22
我有两件事可以帮助:
如本答案中所述,请使用以下代码
-(void) report_memory {
struct task_basic_info info;
mach_msg_type_number_t size = sizeof(info);
kern_return_t kerr = task_info(mach_task_self(),
TASK_BASIC_INFO,
(task_info_t)&info,
&size);
if( kerr == KERN_SUCCESS ) {
NSLog(@"Memory in use (in bytes): %u", info.resident_size);
} else {
NSLog(@"Error with task_info(): %s", mach_error_string(kerr));
}
}
Run Code Online (Sandbox Code Playgroud)查看操作系统为您的应用分配的内存量.这是您应用正在使用的内存上更准确的数字.(你需要#import"mach/mach.h")
干杯!
| 归档时间: |
|
| 查看次数: |
56465 次 |
| 最近记录: |