【问题标题】:purgeMemoryForReason for Camera Control UIImagePickerViewControllerpurgeMemoryForReason 用于相机控制 UIImagePickerViewController
【发布时间】:2011-08-23 15:52:54
【问题描述】:

我正在开发一个带有自定义相机控件的小应用程序。

它的所有功能都运行良好,没有任何内存泄漏

但是当我尝试访问相机超过 8-9 次时,应用程序崩溃......

我用性能工具检查过,但那里没有内存泄漏 ,,, Live Bites 的总大小仅为 4.96 MB

我收到以下错误...



Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x35443a1c __pthread_kill + 8
1   libsystem_c.dylib               0x320e93b4 pthread_kill + 52
2   libsystem_c.dylib               0x320e1bf8 abort + 72
3   libstdc++.6.dylib               0x31d5ca64 __gnu_cxx::__verbose_terminate_handler() + 376
4   libobjc.A.dylib                 0x3011006c _objc_terminate + 104
5   libstdc++.6.dylib               0x31d5ae36 __cxxabiv1::__terminate(void (*)()) + 46
6   libstdc++.6.dylib               0x31d5ae8a std::terminate() + 10
7   libstdc++.6.dylib               0x31d5af5a __cxa_throw + 78
8   libobjc.A.dylib                 0x3010ec84 objc_exception_throw + 64
9   CoreFoundation                  0x3170e1b8 -[NSObject(NSObject) doesNotRecognizeSelector:] + 96
10  CoreFoundation                  0x3170d642 ___forwarding___ + 502
11  CoreFoundation                  0x31684178 _CF_forwarding_prep_0 + 40
12  UIKit                           0x32a37118 -[UIViewController purgeMemoryForReason:] + 20
13  UIKit                           0x32a37146 -[UIViewController didReceiveMemoryWarning] + 10
14  UIKit                           0x32a3715c -[UIViewController _didReceiveMemoryWarning:] + 8
15  Foundation                      0x3632117c _nsnote_callback + 136
16  CoreFoundation                  0x316d9208 __CFXNotificationPost_old + 396
17  CoreFoundation                  0x31673ee4 _CFXNotificationPostNotification + 112
18  Foundation                      0x3631e5cc -[NSNotificationCenter postNotificationName:object:userInfo:] + 64
19  Foundation                      0x363201ba -[NSNotificationCenter postNotificationName:object:] + 18
20  UIKit                           0x32a0d35a -[UIApplication _performMemoryWarning] + 42
21  UIKit                           0x32a0dd7c -[UIApplication _receivedMemoryNotification] + 120
22  UIKit                           0x32a0b500 _memoryStatusChanged + 36
23  CoreFoundation                  0x316d9d62 __CFNotificationCenterDarwinCallBack + 18
24  CoreFoundation                  0x316d6bd8 __CFMachPortPerform + 204
25  CoreFoundation                  0x316e1a90 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 20
26  CoreFoundation                  0x316e3838 __CFRunLoopDoSource1 + 160
27  CoreFoundation                  0x316e4606 __CFRunLoopRun + 514
28  CoreFoundation                  0x31674ebc CFRunLoopRunSpecific + 224
29  CoreFoundation                  0x31674dc4 CFRunLoopRunInMode + 52
30  GraphicsServices                0x36497418 GSEventRunModal + 108
31  GraphicsServices                0x364974c4 GSEventRun + 56
32  UIKit                           0x328e2d62 -[UIApplication _run] + 398
33  UIKit                           0x328e0800 UIApplicationMain + 664
34  Imagepicker                 0x000020ec main (main.m:14)
35  Imagepicker                 0x000020a0 start + 32




Live Bits 小于 5 MB,但我还是遇到了这个崩溃...... 对于 3G 和 3G,它变得更加有线...... 它对他们来说崩溃了很多......而且更经常......

任何帮助?????

【问题讨论】:

  • 请检查最大分配,(除了实时字节)。还要检查您是否在打开相机视图并关闭它时恢复了分配,分配是否添加?
  • 嗨 Ravin ...感谢您的回复...我确实检查了“总体字节”和“实时字节”...。随着我发布它,实时字节确实减少了..但总体字节确实增加了......但我相信整体字节是总分配,但实时字节是用于应用程序的真实字节......

标签: iphone memory mobile uiimagepickercontroller


【解决方案1】:

我在自己构建的相机应用程序中遇到了类似的问题。我收到很多低内存警告。你在看那些吗?

作为一种权宜之计,当我确定问题时,我提出了这样的问题:

- (void)didReceiveMemoryWarning { NSLog(@"内存问题!!!!!!!!!"); NSString *errorString = [NSString stringWithFormat:@"目前没有足够的内存来运行这个应用程序。你应该退出一些应用程序,然后再试一次。"]; UIAlertView *errorAlert = [[UIAlertView alloc] initWithTitle:@"内存不足警告" message:errorString delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [错误警报显示]; [错误警报发布]; [super didReceiveMemoryWarning]; }

【讨论】:

  • 嗨,马克!感谢您的回复 !!我之前也是这么想的..但是很多其他带有相机的应用程序都可以在那时运行..我的意思是其他应用程序,比如Photobooth,并且都具有相机控制功能......它们可以在同一点运行..比我为什么拥有这个问题 !??所以我觉得我在这里做错了什么!您找到其他解决方案了吗?
  • 在未来的某个时候,我将检查我的应用程序并尝试减少内存使用——如果我发现任何特定于相机的内容,我会在这里发布。
  • 有什么帮助吗?我还是卡住了:(
  • 我还没有回过头来。我在想我将不得不使内存使用更加动态。我有一个加载到内存中的对象数组,这些对象在内存不足警告时被转储。我可能需要检查图像是否不在内存中并一次重新加载它们。
  • 感谢您的回复,我知道它完全与内存有关!但是在同一个地方..您的应用程序可以拥有多少内存并不确定!意思是,我的应用程序主要是由于反手打开大量应用程序而导致崩溃....现在,如果我尝试减少应用程序中其他组件对内存的使用..我仍然无法控制相机控制以使用所需的内存, ,, 所以我觉得这一切都取决于应用程序在背面打开.... !!我说的对吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-07-24
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多