Hi,
In our application we need to load new textures every second (or even more often).
The problem is that native memory (not java heap) keeps increasing without bounds.
Things I already tried:
Re: How to load many textures without leaking memory?
Administrator
Hi
You should use GL.glDeleteTextures() and Texture.getTextureObject(GL). If the problem persists, you will have to write a bug report. Texture.destroy(GL) should work.
Re: How to load many textures without leaking memory?
I actually just found a solution, I just had to add a manually System.gc() call after each texture.destroy(gl), then the native memory stays low.
Not sure if this behaviour is intended, but it works.
Re: How to load many textures without leaking memory?
Administrator
Ok I know a better workaround, it comes from the laziness of the virtual machine to reclaim unused native memory. Get the buffer of the texture data, get its cleaner and call Cleaner.clean(). Using System.gc() may have some unwanted effects...