How to release splash-screen image memory?

I’m using libGDX. When my game loads I show a splash screen, and this image is never shown again until you restart the game.

I’d like to release memory this texture occupies (it’s 1024x512 png) after splash screen is removed, but I fail to see a method to do so in libGDX docs. Any ideas?

The Texture object implements Disposable so just invoke dispose before dereferencing it.

This is Java, so if you want to dispose of something you really just need to stop referencing it - BUT if that object implements Disposable, you should invoke this first so it:

A ) Doesn’t have to wait for the GC to clean up it’s background resources
B ) Releases unmanaged resources.

Just remember that after invoking dispose you can’t use the object anymore.

If you are using AssetManager, you need to do the following instead: