Layers of Logic

Phase XIII

Memory and the Garbage Collector

JVM memory areas, reachability, collection, and memory leaks.

2 sections41 min of reading9 exercises

Map Java values and execution state to JVM stacks, the heap, class metadata, run-time constants, and native memory. Then trace reachability from collection roots, compare collector tradeoffs, and identify retained references that cause memory leaks.

When you finish this phase you can

  • Name the JVM memory areas and explain what each one holds
  • Explain why a local variable dies at the closing brace and an object does not
  • Determine when an object is unreachable from garbage-collection roots
  • Explain the observation behind generational collection
  • Explain what a stop the world pause is and why collectors are judged on it
  • Identify memory leaks caused by reachable objects that are no longer useful
  1. 13.1JVM Memory AreasPlace call frames, objects, class metadata, run-time constants, native work, and per-thread execution state in the JVM memory model.The memory areasCore20 min5 exercises
  2. 13.2Reachability and Garbage CollectionDetermine object reachability from garbage-collection roots, explain why cycles can be collected, and identify references that cause memory leaks.Garbage collectionCore21 min4 exercises