O'Reilly logo

Libgdx Cross-platform Game Development Cookbook by Alberto Cejas Sánchez, David Saltares Márquez

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Libgdx features to avoid garbage collection

On one hand, unmanaged languages leave the responsibility of allocating and deallocating memory to the programmer, which allows them to choose the most convenient moment to make use of the required system resources and thus avoiding stuttering.

On the other hand, Java has a double-edged feature that handles the process of deallocating memory automatically whenever an object is no longer in use. This is commonly known as garbage collection. Every now and then, the GC kicks in and checks whether there are unreferenced objects to free up, but this takes time (and can occur in a nonsuitable moment within the game execution).

Sometimes Java programmers rely on its effectiveness and tend to forget about ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required