带相机的iPhone内存警告,但不包含照片库 [英] iPhone Memory Warning with Camera, but not Photo Library

查看:48
本文介绍了带相机的iPhone内存警告,但不包含照片库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在相机"模式下按下UIImagePickerController上的使用"按钮后,我一直收到内存警告.

I'm consistently receiving a memory warning right after pressing the "Use" button on the UIImagePickerController in Camera mode.

我第一次使用Instruments试图弄清楚发生了什么,但是我没有发现问题.在打开图像选择器控制器之前,我的应用程序使用了约2.0 MB的内存.看起来相机"模式和照片库"模式都分配了9.0 MB的内存,但我仅在相机"模式下收到内存警告.

I used Instruments for the first time to try to figure out what's going on, but I don't see a problem. Before opening the image picker controller, my app is using ~2.0 MB of memory. It looks like both Camera mode and Photo Library mode allocate 9.0 MB of memory, but I only receive a memory warning in Camera mode.

我可以在打开控制器之前尝试释放一些内存,但是我的使用率已经很低了.我不明白为什么两个控制器将内存使用量增加相同的数量,但是我从未收到照片库的警告.实际上,我已经能够多次打开照片库并保留图像(内存使用量超过33 MB)没有问题.

I could attempt to free some memory before opening the controller, but my usage is already pretty low. I don't understand why both controllers increase my memory usage by the same amount, but I never receive a warning from the Photo Library. In fact, I've been able to open the Photo Library multiple times and retain the image (putting memory usage at 33+ MB) with no problem.

所有建议将不胜感激.

推荐答案

相机很有可能在不同的进程中运行(我在这里推测),并且其内存使用情况不会计入您的应用程序.无论如何,内存警告并不表示您做错了任何事情.不要尝试提前释放内存,只需响应内存警告,您就可以了.

It's quite possible that the camera runs in a different process (I'm speculating here) and that its memory usage does not count against your app. Regardless, memory warnings are not an indication that you are doing anything wrong. Don't try to free up memory in advance, just respond to memory warnings and you should be fine.

这篇关于带相机的iPhone内存警告,但不包含照片库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆