Why do finalizers have a “severe performance penalty”?

Because of the way the garbage collector works. For performance, most Java GCs use a copying collector, where short-lived objects are allocated into an “eden” block of memory, and when the it’s time for that generation of objects to be collected, the GC just needs to copy the objects that are still “alive” to a … Read more