读书人

bit地图 内存溢出OOM的解决方法分享

发布时间: 2012-09-25 09:55:58 作者: rapoo

bitmap 内存溢出OOM的解决办法分享
BitmapFactory.Options bitmapOptions = new BitmapFactory.Options(); bitmapOptions.inSampleSize = 4; bitmap = BitmapFactory.decodeStream(this.getContentResolver()..openInputStream(uri), null , bitmapOptions);


if (bitmap != null && !bitmap.isRecycled()) bitmap.recycle(); // Eliminate extra GCs during startup by setting the initial heap size to 4MB. // TODO: We should restore the old heap size once the activity reaches the idle state VMRuntime.getRuntime().setMinimumHeapSize(INITIAL_HEAP_SIZE);


读书人网 >移动开发

热点推荐