本机堆android OOM硬件加速

首先,我使用的是运行Android 4.4(kitkat)的Nexus 7(2013年的1080p屏幕),并使用eclipse和Windows的adb插件(64位,我认为)。 我的应用程序minSdkVersion设置为11,只能在横向模式下运行。

问题是我离开我的应用程序运行一段时间后不断收到OOM错误。 我的dalvik堆保持不变,大约在25MB左右,但使用Debug.getNativeHeapAllocatedSize()和Debug.getNativeHeapSize()它表示我的本机堆大小不断增加,直到应用程序崩溃从一个OOM错误。

我通过在清单中声明android:hardwareAccelerated =“true”来使用硬件加速,并在我的SurfaceView构造函数中使用setLayerType(View.LAYER_TYPE_HARDWARE,null)将其设置为硬件加速。

(使用setLayerType(View.LAYER_TYPE_HARDWARE,null)是我的问题,我删除它,内存泄漏停止)。

奇怪的是,一旦我按下主页按钮,然后返回到我的应用程序,本机堆将重置为其初始值。

我的证明dalvik堆保持不变,并且本地堆增长来自LogCat中的这些消息:

debug.native heap:分配191.45MB的191.73MB(0.28MB免费)debug.VM堆内存:分配23.00MB VM堆大小:31.00MB MaxHeapSize:192.00MB:availMemory 634.95MB,lowMemory? 假,阈值96.00MB:canvas.isHardwareAccelerated()= true:GC_FOR_ALLOC释放4566K,30%空闲22608K / 32236K,暂停32ms,总共32ms:调试。 =================================:debug.native heap:分配197.01MB的197.27MB(0.26MB免费) :debug.VM堆内存:分配22.00MB VM堆大小:31.00MB MaxHeapSize:192.00MB:availMemory 629.38MB,lowMemory? 假,阈值96.00MB

然后,一旦本机堆满了,我得到错误:

01-03 17:18:23.424: A/libc(15604): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 15604 (ebe.kingscastle)
01-03 17:18:23.524: I/DEBUG(176): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-03 17:18:23.524: I/DEBUG(176): Build fingerprint: 'google/razor/flo:4.4.2/KOT49H/937116:user/release-keys'
01-03 17:18:23.524: I/DEBUG(176): Revision: '0'
01-03 17:18:23.524: I/DEBUG(176): pid: 15604, tid: 15604, name: ebe.kingscastle  >>> com.kaebe.kingscastle <<<
01-03 17:18:23.524: I/DEBUG(176): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
01-03 17:18:23.614: I/DEBUG(176):     r0 00000000  r1 00020004  r2 00000000  r3 795402d8
01-03 17:18:23.614: I/DEBUG(176):     r4 795402d8  r5 000000a0  r6 bef63450  r7 75aac91c
01-03 17:18:23.614: I/DEBUG(176):     r8 791e0378  r9 00000000  sl 00000001  fp 76b8ef38
01-03 17:18:23.614: I/DEBUG(176):     ip 00000001  sp bef63378  lr 400e7e6b  pc 4015ab6a  cpsr 60010030
01-03 17:18:23.614: I/DEBUG(176):     d0  44ece00043de0000  d1  00000000441b8000
01-03 17:18:23.614: I/DEBUG(176):     d2  43de000000000000  d3  44bda00043ce0000
01-03 17:18:23.614: I/DEBUG(176):     d4  44bda00044b9a000  d5  43ac800043ce0000
01-03 17:18:23.614: I/DEBUG(176):     d6  43ce000043cc8000  d7  44b9a00044bda000
01-03 17:18:23.614: I/DEBUG(176):     d8  0000078000000450  d9  41600000440a0000
01-03 17:18:23.614: I/DEBUG(176):     d10 0000000042080000  d11 0000000000000000
01-03 17:18:23.614: I/DEBUG(176):     d12 0000000000000000  d13 0000000000000000
01-03 17:18:23.614: I/DEBUG(176):     d14 0000000000000000  d15 0000000000000000
01-03 17:18:23.614: I/DEBUG(176):     d16 0000000000000000  d17 3ff0000000000000
01-03 17:18:23.614: I/DEBUG(176):     d18 0000000000000000  d19 3ff0000000000000
01-03 17:18:23.614: I/DEBUG(176):     d20 0000000000000000  d21 0000000000000000
01-03 17:18:23.614: I/DEBUG(176):     d22 0000000000000000  d23 0000000000000000
01-03 17:18:23.614: I/DEBUG(176):     d24 0000000000000000  d25 0000000000000000
01-03 17:18:23.614: I/DEBUG(176):     d26 3ff0000000000000  d27 0000000000000000
01-03 17:18:23.614: I/DEBUG(176):     d28 3ff0000000000000  d29 0000000000000000
01-03 17:18:23.614: I/DEBUG(176):     d30 0000000000000000  d31 0000000000000000
01-03 17:18:23.614: I/DEBUG(176):     scr 20000012
01-03 17:18:23.624: I/DEBUG(176): backtrace:
01-03 17:18:23.624: I/DEBUG(176):     #00  pc 0000bb6a  /system/lib/libutils.so (android::LinearAllocator::newPage(unsigned int)+27)
01-03 17:18:23.624: I/DEBUG(176):     #01  pc 0000bba3  /system/lib/libutils.so (android::LinearAllocator::ensureNext(unsigned int)+52)
01-03 17:18:23.624: I/DEBUG(176):     #02  pc 0000bbe7  /system/lib/libutils.so (android::LinearAllocator::alloc(unsigned int)+40)
01-03 17:18:23.624: I/DEBUG(176):     #03  pc 00013e95  /system/lib/libhwui.so
01-03 17:18:23.624: I/DEBUG(176):     #04  pc 00014621  /system/lib/libhwui.so
01-03 17:18:23.624: I/DEBUG(176):     #05  pc 00012ccd  /system/lib/libhwui.so
01-03 17:18:23.624: I/DEBUG(176):     #06  pc 000136a3  /system/lib/libhwui.so
01-03 17:18:23.624: I/DEBUG(176):     #07  pc 00013719  /system/lib/libhwui.so
01-03 17:18:23.624: I/DEBUG(176):     #08  pc 0001a179  /system/lib/libhwui.so
01-03 17:18:23.624: I/DEBUG(176):     #09  pc 00022717  /system/lib/libhwui.so
01-03 17:18:23.624: I/DEBUG(176):     #10  pc 0002275f  /system/lib/libhwui.so
01-03 17:18:23.624: I/DEBUG(176):     #11  pc 000231fd  /system/lib/libhwui.so
01-03 17:18:23.624: I/DEBUG(176):     #12  pc 00065cf3  /system/lib/libandroid_runtime.so
01-03 17:18:23.624: I/DEBUG(176):     #13  pc 0001dbcc  /system/lib/libdvm.so (dvmPlatformInvoke+112)
01-03 17:18:23.624: I/DEBUG(176):     #14  pc 0004e123  /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)
01-03 17:18:23.624: I/DEBUG(176):     #15  pc 00026fe0  /system/lib/libdvm.so
01-03 17:18:23.624: I/DEBUG(176):     #16  pc 0002dfa0  /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
01-03 17:18:23.624: I/DEBUG(176):     #17  pc 0002b638  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
01-03 17:18:23.624: I/DEBUG(176):     #18  pc 00060865  /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+392)
01-03 17:18:23.624: I/DEBUG(176):     #19  pc 000687c7  /system/lib/libdvm.so
01-03 17:18:23.624: I/DEBUG(176):     #20  pc 00026fe0  /system/lib/libdvm.so
01-03 17:18:23.624: I/DEBUG(176):     #21  pc 0002dfa0  /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
01-03 17:18:23.624: I/DEBUG(176):     #22  pc 0002b638  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
01-03 17:18:23.624: I/DEBUG(176):     #23  pc 00060581  /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+336)
01-03 17:18:23.624: I/DEBUG(176):     #24  pc 00049d0b  /system/lib/libdvm.so
01-03 17:18:23.624: I/DEBUG(176):     #25  pc 0004cde7  /system/lib/libandroid_runtime.so
01-03 17:18:23.624: I/DEBUG(176):     #26  pc 0004db0b  /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+354)
01-03 17:18:23.624: I/DEBUG(176):     #27  pc 0000105b  /system/bin/app_process
01-03 17:18:23.624: I/DEBUG(176):     #28  pc 0000e34b  /system/lib/libc.so (__libc_init+50)
01-03 17:18:23.624: I/DEBUG(176):     #29  pc 00000d7c  /system/bin/app_process
01-03 17:18:23.624: I/DEBUG(176): stack:
01-03 17:18:23.624: I/DEBUG(176):          bef63338  00000000  
01-03 17:18:23.624: I/DEBUG(176):          bef6333c  400e7e6b  /system/lib/libc.so (dlmalloc+4254)
01-03 17:18:23.624: I/DEBUG(176):          bef63340  00020004  
01-03 17:18:23.624: I/DEBUG(176):          bef63344  40120e00  /system/lib/libc.so
01-03 17:18:23.624: I/DEBUG(176):          bef63348  400e6dcd  /system/lib/libc.so (dlmalloc)
01-03 17:18:23.624: I/DEBUG(176):          bef6334c  795402d8  [anon:libc_malloc]
01-03 17:18:23.624: I/DEBUG(176):          bef63350  000000a0  
01-03 17:18:23.624: I/DEBUG(176):          bef63354  bef63450  [stack]
01-03 17:18:23.624: I/DEBUG(176):          bef63358  75aac91c  [anon:libc_malloc]
01-03 17:18:23.624: I/DEBUG(176):          bef6335c  791e0378  [anon:libc_malloc]
01-03 17:18:23.624: I/DEBUG(176):          bef63360  00000000  
01-03 17:18:23.624: I/DEBUG(176):          bef63364  00000001  
01-03 17:18:23.624: I/DEBUG(176):          bef63368  76b8ef38  [anon:libc_malloc]
01-03 17:18:23.624: I/DEBUG(176):          bef6336c  400e4bf9  /system/lib/libc.so (malloc+12)
01-03 17:18:23.624: I/DEBUG(176):          bef63370  795402d8  [anon:libc_malloc]
01-03 17:18:23.624: I/DEBUG(176):          bef63374  4015ab69  /system/lib/libutils.so (android::LinearAllocator::newPage(unsigned int)+26)
01-03 17:18:23.624: I/DEBUG(176):     #00  bef63378  7dbdc008  [anon:libc_malloc]
01-03 17:18:23.624: I/DEBUG(176):          bef6337c  4015aba7  /system/lib/libutils.so (android::LinearAllocator::ensureNext(unsigned int)+56)
01-03 17:18:23.624: I/DEBUG(176):     #01  bef63380  795402d8  [anon:libc_malloc]
01-03 17:18:23.624: I/DEBUG(176):          bef63384  4015abeb  /system/lib/libutils.so (android::LinearAllocator::alloc(unsigned int)+44)
01-03 17:18:23.624: I/DEBUG(176):     #02  bef63388  00000001  
01-03 17:18:23.624: I/DEBUG(176):          bef6338c  79540150  [anon:libc_malloc]
01-03 17:18:23.624: I/DEBUG(176):          bef63390  40bdbf45  /system/lib/libhwui.so
01-03 17:18:23.624: I/DEBUG(176):          bef63394  40bd9e99  /system/lib/libhwui.so
01-03 17:18:23.644: I/DEBUG(176): memory near r1:
01-03 17:18:23.644: I/DEBUG(176):     0001ffe4 ffffffff ffffffff ffffffff ffffffff  
01-03 17:18:23.644: I/DEBUG(176):     0001fff4 ffffffff ffffffff ffffffff ffffffff  
01-03 17:18:23.644: I/DEBUG(176):     00020004 ffffffff ffffffff ffffffff ffffffff  
01-03 17:18:23.644: I/DEBUG(176):     00020014 ffffffff ffffffff ffffffff ffffffff  
01-03 17:18:23.644: I/DEBUG(176):     00020024 ffffffff ffffffff ffffffff ffffffff  
01-03 17:18:23.644: I/DEBUG(176):     00020034 ffffffff ffffffff ffffffff ffffffff  
01-03 17:18:23.644: I/DEBUG(176):     00020044 ffffffff ffffffff ffffffff ffffffff  
01-03 17:18:23.644: I/DEBUG(176):     00020054 ffffffff ffffffff ffffffff ffffffff  
01-03 17:18:23.644: I/DEBUG(176):     00020064 ffffffff ffffffff ffffffff ffffffff  
01-03 17:18:23.644: I/DEBUG(176):     00020074 ffffffff ffffffff ffffffff ffffffff  
01-03 17:18:23.644: I/DEBUG(176):     00020084 ffffffff ffffffff ffffffff ffffffff  
01-03 17:18:23.644: I/DEBUG(176):     00020094 ffffffff ffffffff ffffffff ffffffff  
01-03 17:18:23.644: I/DEBUG(176):     000200a4 ffffffff ffffffff ffffffff ffffffff  
01-03 17:18:23.644: I/DEBUG(176):     000200b4 ffffffff ffffffff ffffffff ffffffff  
01-03 17:18:23.644: I/DEBUG(176):     000200c4 ffffffff ffffffff ffffffff ffffffff  
01-03 17:18:23.644: I/DEBUG(176):     000200d4 ffffffff ffffffff ffffffff ffffffff  
01-03 17:18:23.644: I/DEBUG(176): memory near r3:
01-03 17:18:23.644: I/DEBUG(176):     795402b8 0000000c 0a0a0a01 00000008 3f400000  
01-03 17:18:23.644: I/DEBUG(176):     795402c8 00000000 00000000 0000000b 7953e5f8  
01-03 17:18:23.644: I/DEBUG(176):     795402d8 00020000 00000400 7dbfbfec 7dbdc008  
01-03 17:18:23.644: I/DEBUG(176):     795402e8 79540400 3f986f40 0005fae0 00001fd0  
01-03 17:18:23.644: I/DEBUG(176):     795402f8 00000000 0000004b 00000001 000000c5  
01-03 17:18:23.644: I/DEBUG(176):     79540308 000001a5 00000046 000000d1 3e450000  
01-03 17:18:23.644: I/DEBUG(176):     79540318 3ed28000 3e858000 3f1d8000 0000004b  
01-03 17:18:23.644: I/DEBUG(176):     79540328 00610000 00000000 0000000f ffffff20  
01-03 17:18:23.644: I/DEBUG(176):     79540338 00000000 00000000 76b97ef0 0000005b  
01-03 17:18:23.644: I/DEBUG(176):     79540348 76448690 42923333 3f800000 00000000  
01-03 17:18:23.644: I/DEBUG(176):     79540358 00000000 00000000 00000000 00000000  
01-03 17:18:23.644: I/DEBUG(176):     79540368 00000000 00000000 00000000 00000000  
01-03 17:18:23.644: I/DEBUG(176):     79540378 00000000 ff888888 00000000 40800000  
01-03 17:18:23.644: I/DEBUG(176):     79540388 0b000501 752e3d30 00000001 00000001  
01-03 17:18:23.644: I/DEBUG(176):     79540398 00000054 00000023 0000000a 00000001  
01-03 17:18:23.644: I/DEBUG(176):     795403a8 4c2d6e65 2d6e7461 75005355 78eba550  
01-03 17:18:23.644: I/DEBUG(176): memory near r4:
01-03 17:18:23.644: I/DEBUG(176):     795402b8 0000000c 0a0a0a01 00000008 3f400000  
01-03 17:18:23.644: I/DEBUG(176):     795402c8 00000000 00000000 0000000b 7953e5f8  
01-03 17:18:23.644: I/DEBUG(176):     795402d8 00020000 00000400 7dbfbfec 7dbdc008  
01-03 17:18:23.644: I/DEBUG(176):     795402e8 79540400 3f986f40 0005fae0 00001fd0  
01-03 17:18:23.644: I/DEBUG(176):     795402f8 00000000 0000004b 00000001 000000c5  
01-03 17:18:23.644: I/DEBUG(176):     79540308 000001a5 00000046 000000d1 3e450000  
01-03 17:18:23.644: I/DEBUG(176):     79540318 3ed28000 3e858000 3f1d8000 0000004b  
01-03 17:18:23.644: I/DEBUG(176):     79540328 00610000 00000000 0000000f ffffff20  
01-03 17:18:23.644: I/DEBUG(176):     79540338 00000000 00000000 76b97ef0 0000005b  
01-03 17:18:23.644: I/DEBUG(176):     79540348 76448690 42923333 3f800000 00000000  
01-03 17:18:23.644: I/DEBUG(176):     79540358 00000000 00000000 00000000 00000000  
01-03 17:18:23.644: I/DEBUG(176):     79540368 00000000 00000000 00000000 00000000  
01-03 17:18:23.644: I/DEBUG(176):     79540378 00000000 ff888888 00000000 40800000  
01-03 17:18:23.644: I/DEBUG(176):     79540388 0b000501 752e3d30 00000001 00000001  
01-03 17:18:23.644: I/DEBUG(176):     79540398 00000054 00000023 0000000a 00000001  
01-03 17:18:23.644: I/DEBUG(176):     795403a8 4c2d6e65 2d6e7461 75005355 78eba550  
01-03 17:18:23.644: I/DEBUG(176): memory near r6:
01-03 17:18:23.644: I/DEBUG(176):     bef63430 00000000 79540150 7644dd28 00000000  
01-03 17:18:23.644: I/DEBUG(176):     bef63440 6d46ea14 41504418 bef6351c 40bd971d  
01-03 17:18:23.644: I/DEBUG(176):     bef63450 bef6346c 00000000 00000000 40be017d  
01-03 17:18:23.644: I/DEBUG(176):     bef63460 448a0000 00000000 44f00000 79540150  
01-03 17:18:23.644: I/DEBUG(176):     bef63470 791e0378 00000001 00000000 00000000  
01-03 17:18:23.644: I/DEBUG(176):     bef63480 440a0000 41600000 400d1028 00000000  
01-03 17:18:23.644: I/DEBUG(176):     bef63490 791d0f28 7644dd28 00000000 40be871b  
01-03 17:18:23.644: I/DEBUG(176):     bef634a0 7644dd28 00000000 00000001 791d0f28  
01-03 17:18:23.644: I/DEBUG(176):     bef634b0 bef63508 40be8763 00410001 7644dd28  
01-03 17:18:23.644: I/DEBUG(176):     bef634c0 00000000 00000004 6d46ea2c 40be9201  
01-03 17:18:23.644: I/DEBUG(176):     bef634d0 448a0000 00000001 00000000 40be91cd  
01-03 17:18:23.644: I/DEBUG(176):     bef634e0 41504408 40203cf5 448a0000 00000001  
01-03 17:18:23.644: I/DEBUG(176):     bef634f0 6d4e68b8 41522bd0 00000000 00000780  
01-03 17:18:23.644: I/DEBUG(176):     bef63500 00000450 00000001 6d46ea14 00000001  
01-03 17:18:23.644: I/DEBUG(176):     bef63510 00000008 415e6fd0 41ed3c88 41553127  
01-03 17:18:23.644: I/DEBUG(176):     bef63520 6d46ea14 6f0b0a82 40203caf 41504418  
01-03 17:18:23.644: I/DEBUG(176): memory near r7:
01-03 17:18:23.644: I/DEBUG(176):     75aac8fc 75cef668 fefefe00 00000000 43cc8001  
01-03 17:18:23.644: I/DEBUG(176):     75aac90c 00000000 3f800000 00000000 3f800000  
01-03 17:18:23.644: I/DEBUG(176):     75aac91c 40bf9b88 752d6fc8 fbfbfb00 44b9a000  
01-03 17:18:23.644: I/DEBUG(176):     75aac92c 43ca0000 44bda000 43cc0000 40bf9740  
01-03 17:18:23.644: I/DEBUG(176):     75aac93c 752cc218 00000000 44bf2000 43cc8000  
01-03 17:18:23.644: I/DEBUG(176):     75aac94c 44c2a000 43e00000 752c45b8 75cef668  
01-03 17:18:23.644: I/DEBUG(176):     75aac95c 40bf9700 00000000 43cc8001 00000000  
01-03 17:18:23.644: I/DEBUG(176):     75aac96c 3f800000 00000000 3f800000 40bf9740  
01-03 17:18:23.644: I/DEBUG(176):     75aac97c 78e9b7a8 00000000 44bee000 43ce0000  
01-03 17:18:23.644: I/DEBUG(176):     75aac98c 44c2e000 43de0000 76b95460 75cef668  
01-03 17:18:23.644: I/DEBUG(176):     75aac99c 40bf9b00 00000000 43cc8001 00000000  
01-03 17:18:23.644: I/DEBUG(176):     75aac9ac 3f800000 00000000 3f800000 40bf9b88  
01-03 17:18:23.644: I/DEBUG(176):     75aac9bc 752d6fc8 43cd0000 44bee000 43ca0000  
01-03 17:18:23.644: I/DEBUG(176):     75aac9cc 44c2e000 43cc0000 40bf9740 752cc218  
01-03 17:18:23.644: I/DEBUG(176):     75aac9dc 75aac900 44c46000 43cc8000 44c7e000  
01-03 17:18:23.644: I/DEBUG(176):     75aac9ec 43e00000 752c45b8 75cef668 40bf9700  
01-03 17:18:23.644: I/DEBUG(176): memory near r8:
01-03 17:18:23.644: I/DEBUG(176):     791e0358 00000001 00000002 00000003 00000000  
01-03 17:18:23.644: I/DEBUG(176):     791e0368 00000000 000003e8 00000000 00000243  
01-03 17:18:23.644: I/DEBUG(176):     791e0378 40bfa170 00000780 00000450 3a888889  
01-03 17:18:23.644: I/DEBUG(176):     791e0388 00000000 00000000 00000000 00000000  
01-03 17:18:23.644: I/DEBUG(176):     791e0398 baed7304 00000000 00000000 00000000  
01-03 17:18:23.644: I/DEBUG(176):     791e03a8 00000000 bf800000 00000000 bf800000  
01-03 17:18:23.644: I/DEBUG(176):     791e03b8 3f800000 80000000 3f800000 00000013  
01-03 17:18:23.644: I/DEBUG(176):     791e03c8 3f800000 00000000 00000000 00000000  
01-03 17:18:23.644: I/DEBUG(176):     791e03d8 00000000 3f800000 00000000 00000000  
01-03 17:18:23.644: I/DEBUG(176):     791e03e8 00000000 00000000 3f800000 00000000  
01-03 17:18:23.644: I/DEBUG(176):     791e03f8 00000000 00000000 00000000 3f800000  
01-03 17:18:23.644: I/DEBUG(176):     791e0408 00000010 00000002 7644c788 752c3078  
01-03 17:18:23.644: I/DEBUG(176):     791e0418 00000000 00000000 44f00000 448a0000  
01-03 17:18:23.644: I/DEBUG(176):     791e0428 00000000 00000000 00000000 00000000  
01-03 17:18:23.644: I/DEBUG(176):     791e0438 00000000 3f800000 00000000 3f800000  
01-03 17:18:23.644: I/DEBUG(176):     791e0448 00000000 00000000 3f800000 00000000  
01-03 17:18:23.644: I/DEBUG(176): memory near fp:
01-03 17:18:23.644: I/DEBUG(176):     76b8ef18 00250003 00550043 004e0056 00030047  
01-03 17:18:23.644: I/DEBUG(176):     76b8ef28 00000000 00000007 00000040 0000001b  
01-03 17:18:23.644: I/DEBUG(176):     76b8ef38 76b97af8 76b97c78 76b97c70 76b97c88  
01-03 17:18:23.644: I/DEBUG(176):     76b8ef48 00000018 0000005b 76448690 44160000  
01-03 17:18:23.644: I/DEBUG(176):     76b8ef58 3f800000 00000000 00000000 00000000  
01-03 17:18:23.644: I/DEBUG(176):     76b8ef68 00000000 00000000 00000000 00000000  
01-03 17:18:23.644: I/DEBUG(176):     76b8ef78 00000000 00000000 00000000 ff888888  
01-03 17:18:23.644: I/DEBUG(176):     76b8ef88 00000000 40800000 0b010501 791e06e0  
01-03 17:18:23.644: I/DEBUG(176):     76b8ef98 00000001 00000001 00000009 0000005b  
01-03 17:18:23.644: I/DEBUG(176):     76b8efa8 76448690 42923333 3f800000 00000000  
01-03 17:18:23.644: I/DEBUG(176):     76b8efb8 00000000 00000000 00000000 00000000  
01-03 17:18:23.644: I/DEBUG(176):     76b8efc8 00000000 00000000 00000000 00000000  
01-03 17:18:23.644: I/DEBUG(176):     76b8efd8 00000000 ff444444 00000000 40800000  
01-03 17:18:23.644: I/DEBUG(176):     76b8efe8 0b000501 78ebaf68 00000001 00000001  
01-03 17:18:23.644: I/DEBUG(176):     76b8eff8 00000054 0000002b 00000001 00000010  
01-03 17:18:23.644: I/DEBUG(176):     76b8f008 00000000 00000000 76e80480 00000000  
01-03 17:18:23.644: I/DEBUG(176): memory near sp:
01-03 17:18:23.644: I/DEBUG(176):     bef63358 75aac91c 791e0378 00000000 00000001  
01-03 17:18:23.644: I/DEBUG(176):     bef63368 76b8ef38 400e4bf9 795402d8 4015ab69  
01-03 17:18:23.644: I/DEBUG(176):     bef63378 7dbdc008 4015aba7 795402d8 4015abeb  
01-03 17:18:23.644: I/DEBUG(176):     bef63388 00000001 79540150 40bdbf45 40bd9e99  
01-03 17:18:23.644: I/DEBUG(176):     bef63398 79540150 40bda625 00000003 00000001  
01-03 17:18:23.644: I/DEBUG(176):     bef633a8 752c3280 448a1000 448a0000 448a0000  
01-03 17:18:23.644: I/DEBUG(176):     bef633b8 00000000 00000001 76b95460 448a0000  
01-03 17:18:23.644: I/DEBUG(176):     bef633c8 00000000 00000450 00000780 bef63450  
01-03 17:18:23.644: I/DEBUG(176):     bef633d8 40bdbf45 bef63450 00000001 0000010d  
01-03 17:18:23.644: I/DEBUG(176):     bef633e8 00000000 00000001 76b8ef38 40bd8ccf  
01-03 17:18:23.644: I/DEBUG(176):     bef633f8 00000001 75aac91c 00000001 7953c9e0  
01-03 17:18:23.644: I/DEBUG(176):     bef63408 791e0378 40bd96a7 448a0000 00000000  
01-03 17:18:23.644: I/DEBUG(176):     bef63418 00000000 400e4c0d 00000000 75aac91c  
01-03 17:18:23.644: I/DEBUG(176):     bef63428 00000000 791d0f28 00000000 79540150  
01-03 17:18:23.644: I/DEBUG(176):     bef63438 7644dd28 00000000 6d46ea14 41504418  
01-03 17:18:23.644: I/DEBUG(176):     bef63448 bef6351c 40bd971d bef6346c 00000000  
01-03 17:18:23.644: I/DEBUG(176): code around pc:
01-03 17:18:23.644: I/DEBUG(176):     4015ab48 6182020c b508bd10 695a4603 f0213107  
01-03 17:18:23.644: I/DEBUG(176):     4015ab58 18110003 615969da 61d91c51 ebf0f7fe  
01-03 17:18:23.644: I/DEBUG(176):     4015ab68 60022200 b510bd08 f7ff4604 bb08ffc0  
01-03 17:18:23.644: I/DEBUG(176):     4015ab78 b16b68e3 f5b06820 d2093f00 f5b10041  
01-03 17:18:23.644: I/DEBUG(176):     4015ab88 bf283f00 3100f44f f0221cca 60230303  
01-03 17:18:23.644: I/DEBUG(176):     4015ab98 682169a0 46201842 f7ff61a2 68e1ffd4  
01-03 17:18:23.644: I/DEBUG(176):     4015aba8 6008b101 60e06923 6120b903 f0203007  
01-03 17:18:23.644: I/DEBUG(176):     4015abb8 60a20203 b538bd10 68433103 0503f021  
01-03 17:18:23.644: I/DEBUG(176):     4015abc8 429d4604 4629d909 ff91f7ff e00fb928  
01-03 17:18:23.644: I/DEBUG(176):     4015abd8 300760e0 0003f020 4620bd38 f7ff4629  
01-03 17:18:23.644: I/DEBUG(176):     4015abe8 68a0ffc2 194269a1 1b4d60a2 bd3861a5  
01-03 17:18:23.644: I/DEBUG(176):     4015abf8 46204629 ffa7f7ff 6a236921 62221c5a  
01-03 17:18:23.644: I/DEBUG(176):     4015ac08 68e36001 2b006120 e7e1d1e3 edd0b570  
01-03 17:18:23.644: I/DEBUG(176):     4015ac18 f2407a05 ee1773cf 429a2a90 4604b086  
01-03 17:18:23.644: I/DEBUG(176):     4015ac28 461e460d 4b33d804 7ae7eef8 e00b447b  
01-03 17:18:23.654: I/DEBUG(176):     4015ac38 4282482e 4b30d804 7acbeefa e003447b  
01-03 17:18:23.654: I/DEBUG(176): code around lr:
01-03 17:18:23.654: I/DEBUG(176):     400e7e48 e0043608 fafcf003 210c2600 49356001  
01-03 17:18:23.654: I/DEBUG(176):     400e7e58 f8d14479 079321bc f501d53f f7fd70e0  
01-03 17:18:23.654: I/DEBUG(176):     400e7e68 e03aed3c 42b06898 a8d4f43f b8d5f7ff  
01-03 17:18:23.654: I/DEBUG(176):     400e7e78 42b56895 aa31f43f ba32f7ff 447e4e2a  
01-03 17:18:23.654: I/DEBUG(176):     400e7e88 01bcf8d6 0204f040 21bcf8c6 36fff04f  
01-03 17:18:23.654: I/DEBUG(176):     400e7e98 4b13e462 d8d5429f f04fe467 e4850901  
01-03 17:18:23.654: I/DEBUG(176):     400e7ea8 f01268da f43f0f08 e4d1acc1 071068da  
01-03 17:18:23.654: I/DEBUG(176):     400e7eb8 ace4f57f 481de6cf f7ff4478 481cb8b1  
01-03 17:18:23.654: I/DEBUG(176):     400e7ec8 f7ff4478 688cb8ad f43f4294 e5c9adc8  
01-03 17:18:23.654: I/DEBUG(176):     400e7ed8 f47f1c71 2500ac22 4630e7d0 8ffee8bd  
01-03 17:18:23.654: I/DEBUG(176):     400e7ee8 7ffffffe 00032d8c 0003d6d6 0003d6ba  
01-03 17:18:23.654: I/DEBUG(176):     400e7ef8 0003d6a6 0003d63e 0003d5ae 0003d556  
01-03 17:18:23.654: I/DEBUG(176):     400e7f08 0003d53c 0003d51a 0003d4de 0003d474  
01-03 17:18:23.654: I/DEBUG(176):     400e7f18 00032ac0 0003d3dc 0003d384 0003d36c  
01-03 17:18:23.654: I/DEBUG(176):     400e7f28 0003d352 0003d324 0003d2f6 0003293c  
01-03 17:18:23.654: I/DEBUG(176):     400e7f38 00032934 4ff7e92d 4b5c461e 468a4604  
01-03 17:18:23.834: W/ActivityManager(593):   Force finishing activity com.kaebe.kingscastle/com.kaebe.kingscastlelib.KingsCastle
01-03 17:18:24.174: I/ActivityManager(593): Process com.kaebe.kingscastle (pid 15604) has died.
01-03 17:18:24.174: I/WindowState(593): WIN DEATH: Window{42329cd8 u0 SurfaceView}
01-03 17:18:24.174: I/WindowState(593): WIN DEATH: Window{42af0fe8 u0 com.kaebe.kingscastle/com.kaebe.kingscastle.KingsCastleFree}
01-03 17:18:24.184: I/WindowState(593): WIN DEATH: Window{4236fa28 u0 SurfaceView}
01-03 17:18:24.184: I/WindowState(593): WIN DEATH: Window{4236efa8 u0 com.kaebe.kingscastle/com.kaebe.kingscastlelib.KingsCastle}
01-03 17:18:24.194: I/ActivityManager(593): Start proc com.kaebe.kingscastle for activity com.kaebe.kingscastle/.KingsCastleFree: pid=17067 uid=10115 gids={50115}
01-03 17:18:24.204: D/dalvikvm(17067): Late-enabling CheckJNI
01-03 17:18:24.235: D/Zygote(178): Process 15604 terminated by signal (11)

我想知道如何防止本地堆内存泄漏,因为我不知道如何在达尔维克堆上的本地块上进行分配。

我通过这种方式解决了这个问题,只是想写出来帮助其他人,因为在搜索的日子里我找不到答案。


我花了几天的时间寻找解决方案,为什么我的本地堆越来越多,我的达尔维克堆保持不变。 在阅读了很多问题和android文档页面之后,我终于尝试关闭硬件加速,因为我遇到了与这两者有关的OOM问题。

我从SurfaceView中删除了setLayerType(View.LAYER_TYPE_HARDWARE,null)行,问题就消失了。 我在尝试启用硬件加速的一些建议的一些建议后添加了该行,我从来没有真正明白我在那里做了什么。 出于某种原因,该行导致大约1mb / 2秒被添加到本地堆直到我的程序崩溃。

因此,对于任何想要解决问题的人来说,一次只能尝试一件事,并在将其复制粘贴到代码之前了解您的尝试。

我仍然不知道为什么导致本地堆不断增加。

我希望这可以帮助有OOM本机堆问题的人。


当动画试图添加setLayerType(View.LAYER_TYPE_SOFTWARE,null)以关闭硬件加速可能会解决问题?

链接地址: http://www.djcxy.com/p/93063.html

上一篇: Native heap android OOM hardware acceleration

下一篇: Android and running OOM with free heap space left