Question

I'm developing a game using libgdx in android. I dispose all the textures I use when the game ends (win-lose-restart) but my vm is not cleared. I tried

gl.glDeleteTextures(1, textureHandle, 0);

I dispose all textures, world, objects, etc. But vm size is the same. Due to this problem I get OutOfMemoryException after playing a few levels.

Was it helpful?

Solution

What libgdx APIs are you using to load textures? By default libgdx will manage texture memory so that it can, for example, reload textures into video RAM if your app gets suspended. See the badlogic blog post about context loss here: http://www.badlogicgames.com/wordpress/?p=1073

What this means is that you need to tell libgdx to release the Texture, not just directly tell OpenGL to release the texture. See Texture.dispose().

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top