Android-view.Surface OutOfResourcesException [英] Android - view.Surface OutOfResourcesException

查看:97
本文介绍了Android-view.Surface OutOfResourcesException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用ListView导航和标准菜单键在其内部移动时,我的Android应用程序似乎未释放其视图.在加载了大约100个左右(在10个左右的唯一视图中)后,它开始滞后并进行黑屏.

My Android app seems to not be releasing its views when I move around inside of it with ListView navigation and with the standard Menu key. After a hundred or so different (of the 10 or so unique views) loads, it starts lagging and black screening.

错误日志:

07-01 09:54:42.913: INFO/ActivityManager(1279): Starting: Intent { cmp=com.site.android.conferencecompanion/.Search } from pid 31290
07-01 09:54:43.013: ERROR/msm7x30.gralloc(1279): /dev/pmem: no more pmem available
07-01 09:54:43.013: ERROR/msm7x30.gralloc(1279): couldn't open pmem (No such file or directory)
07-01 09:54:43.013: ERROR/msm7x30.gralloc(1279): gralloc failed err=Out of memory
07-01 09:54:43.013: WARN/GraphicBufferAllocator(1279): alloc(480, 800, 1, 00000133, ...) failed -12 (Out of memory)
07-01 09:54:43.013: DEBUG/GraphicBufferAllocator(1279): Allocated buffers:
07-01 09:54:43.013: DEBUG/GraphicBufferAllocator(1279):   0x290740: 1500.00 KiB |  480 ( 480) x  800 |        1 | 0x00000133
07-01 09:54:43.013: DEBUG/GraphicBufferAllocator(1279):   0x307448:   60.00 KiB |  102 ( 128) x  120 |        1 | 0x00000133
07-01 09:54:43.013: DEBUG/GraphicBufferAllocator(1279):   0x32e4c0:   71.25 KiB |  480 ( 480) x   38 |        1 | 0x00000133
07-01 09:54:43.013: DEBUG/GraphicBufferAllocator(1279):   0x3caad8:   60.00 KiB |  102 ( 128) x  120 |        1 | 0x00000133
07-01 09:54:43.013: DEBUG/GraphicBufferAllocator(1279):   0x4a47f8: 1346.25 KiB |  480 ( 480) x  718 |        1 | 0x00000133
07-01 09:54:43.013: DEBUG/GraphicBufferAllocator(1279):   0x4f9710: 1500.00 KiB |  480 ( 480) x  800 |        1 | 0x00000133
07-01 09:54:43.013: DEBUG/GraphicBufferAllocator(1279):   0x54c500: 1500.00 KiB |  480 ( 480) x  800 |        1 | 0x00000133
07-01 09:54:43.013: DEBUG/GraphicBufferAllocator(1279):   0x5d1c00: 1500.00 KiB |  480 ( 480) x  800 |        1 | 0x00000133
07-01 09:54:43.013: DEBUG/GraphicBufferAllocator(1279):   0x5f5f98: 1500.00 KiB |  480 ( 480) x  800 |        1 | 0x00000133
07-01 09:54:43.013: DEBUG/GraphicBufferAllocator(1279):   0x604600:   60.00 KiB |  126 ( 128) x  120 |        1 | 0x00000133
07-01 09:54:43.013: DEBUG/GraphicBufferAllocator(1279):   0x60a3d0:  750.00 KiB |  480 ( 480) x  800 |        4 | 0x00000133
07-01 09:54:43.013: DEBUG/GraphicBufferAllocator(1279):   0x661270: 1428.75 KiB |  480 ( 480) x  762 |        1 | 0x00000133
07-01 09:54:43.013: DEBUG/GraphicBufferAllocator(1279):   0x6830b8:  750.00 KiB |  480 ( 480) x  800 |        4 | 0x00000133
07-01 09:54:43.013: DEBUG/GraphicBufferAllocator(1279):   0x70e0e8: 1500.00 KiB |  480 ( 480) x  800 |        1 | 0x00000133
07-01 09:54:43.013: DEBUG/GraphicBufferAllocator(1279):   0x71f238:   71.25 KiB |  480 ( 480) 
07-01 09:54:43.013: ERROR/SurfaceFlinger(1279): Layer::requestBuffer(this=0x189d50), index=0, w=480, h=800 failed (Out of memory)
07-01 09:54:43.013: ERROR/Surface(31290): Surface (identity=4545) requestBuffer(0, 0, 0, 0, 00000033) returned a buffer with a null handle
07-01 09:54:43.013: ERROR/Surface(31290): getBufferLocked(0, 0, 0, 0, 00000033) failed (Out of memory)
07-01 09:54:43.013: ERROR/Surface(31290): dequeueBuffer failed (Out of memory)
07-01 09:54:43.013: ERROR/ViewRoot(31290): OutOfResourcesException locking surface
07-01 09:54:43.013: ERROR/ViewRoot(31290): android.view.Surface$OutOfResourcesException
07-01 09:54:43.013: ERROR/ViewRoot(31290):     at android.view.Surface.lockCanvasNative(Native Method)
07-01 09:54:43.013: ERROR/ViewRoot(31290):     at android.view.Surface.lockCanvas(Surface.java:314)
07-01 09:54:43.013: ERROR/ViewRoot(31290):     at android.view.ViewRoot.draw(ViewRoot.java:1457)
07-01 09:54:43.013: ERROR/ViewRoot(31290):     at android.view.ViewRoot.performTraversals(ViewRoot.java:1259)
07-01 09:54:43.013: ERROR/ViewRoot(31290):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1860)
07-01 09:54:43.013: ERROR/ViewRoot(31290):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-01 09:54:43.013: ERROR/ViewRoot(31290):     at android.os.Looper.loop(Looper.java:123)
07-01 09:54:43.013: ERROR/ViewRoot(31290):     at android.app.ActivityThread.main(ActivityThread.java:3839)
07-01 09:54:43.013: ERROR/ViewRoot(31290):     at java.lang.reflect.Method.invokeNative(Native Method)
07-01 09:54:43.013: ERROR/ViewRoot(31290):     at java.lang.reflect.Method.invoke(Method.java:507)
07-01 09:54:43.013: ERROR/ViewRoot(31290):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
07-01 09:54:43.013: ERROR/ViewRoot(31290):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
07-01 09:54:43.013: ERROR/ViewRoot(31290):     at dalvik.system.NativeStart.main(Native Method)
07-01 09:54:43.203: INFO/ActivityManager(1279): Displayed com.site.android.conferencecompanion/.Search: +292ms

adb shell dumpsys window显示以下内容:

#1 - #29, junk
#30: AppWindowToken{40bbc000 token=HistoryRecord{408cc260 com.site.android.conferencecompanion/.ProgramDates}}

...

#142: AppWindowToken{40ba65a8 token=HistoryRecord{40b93808 com.site.android.conferencecompanion/.ProgramSpeakers}}

因此,如果我理解正确,那么内存中将保留大约112个视图.有什么我可以做的吗?我是否缺少检查或标志或参数?我误解了转储吗?

So, if I understand correctly, something like 112 views are being held in memory. Is there something I can do about this? Is there a check or a flag or a parameter I'm missing? Am I misinterpretting the dump?

谢谢!

推荐答案

一种检查泄漏源的好方法是,如果您在Eclipse中,则选择Window-> Open Perspecive-> DDMS,然后选择正在运行的进程从进程选择中使用分配跟踪器.启动应用程序,但请勿触摸该应用程序,然后再启动分配跟踪器.然后执行您认为会导致问题的措施,然后每次检查分配.这应该向您确切显示导致泄漏的代码.

A great way to check to see where leaks are coming from is , if you are in Eclipse, Window->Open Perspecive -> DDMS then select the running process from the process selection and use the allocation tracker.Boot the app but DO NOT touch the app before you start the allocation tracker. Then do what you think will cause the problem and then check the allocations every time. This should show you exactly what code is causing a leak.

另外,如果您发布代码,我们可以看一下.

Also if you post you code we could take a look at it.

这篇关于Android-view.Surface OutOfResourcesException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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