Walking dead objects, or GC is always right
We’ll talk about implementation details of different GC algorithms that cause some objects to be collected unexpectedly but others to stay on the heap for a long time after they have become unreachable. We’ll also discuss whether this can be dangerous for your application and how to reduce the damage.
Automatic memory management is said to be one of the greatest features of Java as well as other managed programming languages. At the same time, JVM specification says almost nothing about how exactly it should work! As a result, there are so many various algorithms and strategies of Garbage Collection, each with its own benefits, trade-offs and implementation details. For example, different GCs answer the question "when should we reclaim an object that is considered to be garbage?" differently. It is not so obvious, and every answer can dramatically change the behaviour of an application.
In this talk we will find out why GC store some dead objects on the heap, how this can influence your code and how to protect an application from zombie apocalypse.