Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JNI ERROR (app bug): non-zero capacity for NULL pointer: 80000 in LibGDX

As I have previously asked and some people have asked me to post the dalvik compiler log,here you go. Please notify me of where exactly the memory leak is taking place and the necessary changes i've to make in my code. Thanks!

 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)
like image 652
Chandrasekhar Malladi Avatar asked Dec 10 '25 08:12

Chandrasekhar Malladi


1 Answers

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.

like image 66
P.T. Avatar answered Dec 13 '25 04:12

P.T.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!