O'Reilly logo

Java Language Features: With Modules, Streams, Threads, I/O, and Lambda Expressions by Kishori Sharan

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

© Kishori Sharan 2018
Kishori SharanJava Language Featureshttps://doi.org/10.1007/978-1-4842-3348-1_11

11. Garbage Collection

Kishori Sharan
(1)
Montgomery, Alabama, USA
 
In this chapter, you will learn:
  • What garbage collection is
  • How garbage collection is implemented in Java
  • How to pass a hint to the JVM to run the garbage collector
  • How to implement the finalizers
  • Different states of an object based on its reachability and finalization status
  • The difference between strong and weak references
  • How to use weak references to implement memory-sensitive cache
  • How to use PhantomReference and ReferenceQueue classes to implement cleanup tasks for objects
  • How to use the new Cleaner class in JDK9 to perform cleanup work for phantom reachable objects
All example programs ...

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