3

正如我之前问过的,有些人要求我发布 dalvik 编译器日志,给你。请通知我内存泄漏的确切位置以及我必须在代码中进行的必要更改。谢谢!

 E/dalvikvm(25715): JNI ERROR (app bug): non-zero capacity for NULL pointer: 80000
     I/dalvikvm(25715): "GLThread 693" prio=5 tid=11 RUNNABLE
     I/dalvikvm(25715):   | group="main" sCount=0 dsCount=0 obj=0x428f5be0 self=0x73044008
     I/dalvikvm(25715):   | sysTid=25731 nice=0 sched=0/0 cgrp=apps handle=1929659480
     I/dalvikvm(25715):   | state=R schedstat=( 0 0 0 ) utm=23529 stm=2568 core=1
     I/dalvikvm(25715): com.badlogic.gdx.utils.BufferUtils.newDisposableByteBuffer( Native Method)  
     I/dalvikvm(25715): at com.badlogic.gdx.utils.BufferUtils.newUnsafeByteBuffer(BufferUtils.java:288)
     I/dalvikvm(25715):   at com.badlogic.gdx.graphics.glutils.VertexArray.<init>(VertexArray.java:62)
     I/dalvikvm(25715):   at com.badlogic.gdx.graphics.glutils.VertexArray.<init>(VertexArray.java:53)
     I/dalvikvm(25715):   at com.badlogic.gdx.graphics.Mesh.<init>(Mesh.java:
     I/dalvikvm(25715):   at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:173)
     I/dalvikvm(25715):   at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:142)
     I/dalvikvm(25715):   at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:121)
     I/dalvikvm(25715):   at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:115)
     I/dalvikvm(25715):   at screens.CamelScreen.render(CamelScreen.java:64)
     I/dalvikvm(25715):   at com.badlogic.gdx.Game.render(Game.java:46)
     I/dalvikvm(25715):   at com.connectdots.Connectdots.render(Connectdots.java:34)
     I/dalvikvm(25715):   at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:457)
     I/dalvikvm(25715):   at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1523)
     I/dalvikvm(25715):   at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
     E/dalvikvm(25715): VM aborting
     A/libc(25715): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 25731 (Thread-693)
     W/libc(25715): pthread_create failed: couldn't allocate 1048576-byte stack
     E/libutils.threads(25715): androidCreateRawThreadEtc failed (entry=0x40198529, res=11, errno=0)
     E/libutils.threads(25715): (android threadPriority=0)
4

1 回答 1

4

Use the DDMS Memory Tracker and Heap Analyzer to figure out where your memory leak is. This backtrace is just the final allocation that hit the limit.

You are allocating a SpriteBatch in render, unless you have some lazy initialization code around that allocation, it seems rather sketchy. See https://code.google.com/p/libgdx/wiki/SpriteBatch.

于 2013-09-11T06:33:05.187 回答