I think these demos try to keep things simple. They should show how the basic things in libgdx work in a minimalistic way, and thus, some details are also partially abstracted. This is useful for beginners not to inflate examples with a lot of special code.
In a real world example, I think that SpriteBatch.dispose() should be called in the dispose() method of the GameScreen in SuperJumper, for example. And also GameScreen.dispose() needs to be called when returning to MainMenuScreen , because this also does not happen automatically.
When creating a Spritebatch similar to this new SpriteBatch() , it creates one internal Mesh . When SpriteBatch.dispose() is not called, this mesh will also not be removed, and thus the SuperJumper has a memory leak.
noone
source share