机器人 - 创建位图时出现内存不足异常 [英] android - out of memory exception when creating bitmap

查看:150
本文介绍了机器人 - 创建位图时出现内存不足异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建位图四周之后第二次出现以下错误:

I am getting the following error after creating bitmap second time around:

04-17 18:28:09.310: ERROR/AndroidRuntime(3458): java.lang.OutOfMemoryError: bitmap size exceeds VM budget

this._profileBitmap = Bitmap.createBitmap(_profileBitmap, xCoor,  yCoor, width, height);

从日志:

04-17 18:27:57.500: INFO/CameraCropView(3458): Original Photo Size: W 1536 x H 2048   
04-17 18:28:06.170: INFO/CameraCropView(3458): xCoor: 291   
04-17 18:28:06.170: INFO/CameraCropView(3458): yCoor: 430    
04-17 18:28:06.170: INFO/CameraCropView(3458): Width: 952  
04-17 18:28:06.170: INFO/CameraCropView(3458): Height: 952  

由于图像是巨大的,我得到的错误。但有趣的是错误不会发生的第一次,只有当我拍摄照片的第二次,这使我相信这profileBitmap不被破坏。我怎么打扫一下吗?

Since the image is huge I get the error. But the interesting thing is the error does not happen the first time, only when I take the picture the second time, which makes me believe this profileBitmap is NOT destroyed. How do I clean this up?

推荐答案

有许多问题与位图在Android上,其中有许多是在计算器讨论内存异常。或许,这将是最好的,如果你通过现有的问题,去看看你的匹配现有的一个,那么如果没有,写了什么使你的情况有所不同。

There are many problems with memory exceptions with bitmaps on Android, many of which are discussed on stackoverflow. It would probably be best if you went through the existing questions to see if yours matches one of the existing ones, then if not, write up what makes your situation different.

一些例子:

<一个href="http://stackoverflow.com/questions/5321579/out-of-memory-exception-due-to-large-bitmap-size">Out内存异常,由于大的位图尺寸

<一个href="http://stackoverflow.com/questions/3238388/android-out-of-memory-exception-in-gallery">Android:在库内存异常

<一个href="http://stackoverflow.com/questions/3724082/android-handling-out-of-memory-exception-on-image-processing">Android处理内存溢出异常图像处理

等: <一href="http://stackoverflow.com/search?q=android+out+of+memory+exception+bitmap">http://stackoverflow.com/search?q=android+out+of+memory+exception+bitmap

这篇关于机器人 - 创建位图时出现内存不足异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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