mgsx-dev/gdx-gltf

Native memory leak: pixmaps are never released

dar-dev opened this issue · 4 comments

Pixmaps are never released after loading glTF images, see:

Here's a simple test code to replicate:

for (;;)
{
	final GLBLoader loader = new GLBLoader();
	SceneAsset asset = loader.load(Gdx.files.absolute(filename), true);

	Thread.sleep(100);

	loader.dispose();
	asset.dispose();
}

Good catch, it was a regression introduced in df61161
It should be OK now

That's good.
Now, how can I avoid the pixmap loading when loading glTF textures? (are pixmaps needed?)

--

Yes, that was the purpose of the change : sometimes you want to get texture pixels. And they were disposed at the wrong time.
If you don't want to keep them, you could dispose them after SceneAsset loading (by disposing them and nullify the array)

no, you need to decode PNG/JPG into Pixmap prior to upload pixels to GPU.