java.lang.OutOfMemoryError:位图大小超出VM预算

我正在尝试将应用程序的布局从纵向更改为横向,反之亦然。但是,如果我经常或多次执行此操作,则有时我的应用程序崩溃。.下面是错误日志。请提出可以做什么?


 01-06 09:52:27.787: ERROR/dalvikvm-heap(17473): 1550532-byte external allocation too large for this process. 01-06 09:52:27.787: ERROR/dalvikvm(17473): Out of memory: Heap Size=6471KB, Allocated=4075KB, Bitmap Size=9564KB 

 01-06 09:52:27.787: ERROR/(17473): VM won't let us allocate 1550532 bytes 

 01-06 09:52:27.798: DEBUG/skia(17473): --- decoder->decode returned false

 01-06 09:52:27.798: DEBUG/AndroidRuntime(17473): Shutting down VM

 01-06 09:52:27.798: WARN/dalvikvm(17473): threadid=3: thread exiting with uncaught exception (group=0x4001e390)

 01-06 09:52:27.807: ERROR/AndroidRuntime(17473): Uncaught handler: thread main exiting due to uncaught exception

 01-06 09:52:27.857: ERROR/AndroidRuntime(17473): java.lang.RuntimeException: Unable to start activity ComponentInfo{}: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown

 01-06 09:52:27.857: ERROR/AndroidRuntime(17473):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2596) 

 01-06 09:52:27.857: ERROR/AndroidRuntime(17473):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2621) 

 01-06 09:52:27.857: ERROR/AndroidRuntime(17473):     at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3812) 

 01-06 09:52:27.857: ERROR/AndroidRuntime(17473):     at android.app.ActivityThread.access$2300(ActivityThread.java:126) 

 01-06 09:52:27.857: ERROR/AndroidRuntime(17473):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1936) 

 01-06 09:52:27.857: ERROR/AndroidRuntime(17473):     at android.os.Handler.dispatchMessage(Handler.java:99) 

 01-06 09:52:27.857: ERROR/AndroidRuntime(17473):     at android.os.Looper.loop(Looper.java:123) 

 01-06 09:2:27.857: ERROR/AndroidRuntime(17473):     at android.app.ActivityThread.main(ActivityThread.java:4595) 

元芳怎么了
浏览 709回答 3
3回答

倚天杖

我多次遇到java.lang.OutOfMemoryError:位图大小超过VM预算错误1)在一段时间后从应用程序切换回应用程序时(按主页按钮并浏览了一些网址之后)2)频繁登录/注销到应用程序时(10秒内)3)水平/垂直切换设备时最后我按照以下方式解决了错误&nbsp; &nbsp; public void clearAllResources() {&nbsp; &nbsp; // Set related variables null&nbsp; &nbsp; System.gc();&nbsp; &nbsp; Runtime.getRuntime().gc();&nbsp; &nbsp;}
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Android