1. Concept library
  2. Java & Spring Boot
  3. Module 3: JVM internals

Concept

Object lifecycle and references

How an object is created, referenced, shared and finally becomes unreachable.

What a session covers

The tutor works through these with you, in conversation and code. A session ends when you have shown them, not when a video does.

  1. Trace an object from creation to becoming unreachable
  2. Explain what keeps an object reachable
  3. Spot the static collection or listener that keeps objects alive forever

In practice

A few lines that show Object lifecycle and references doing its job.

Java
var registry = new ArrayList<Listener>();
var listener = new Listener();
registry.add(listener);        // now two references keep it alive

listener = null;               // the local is gone...
// ...but registry still holds it, so it is not garbage.
registry.remove(0);            // now unreachable: eligible for collection

The common mistake

Watch for

Adding objects to a static collection or registering listeners and never removing them. They stay reachable forever, and the "memory leak" is just references nobody cleared.

What to know first

Your roadmap puts these before Object lifecycle and references, unless you already know them.

How it stays learned

Once a session shows you understand Object lifecycle and references, it comes back for review. Each review takes a minute and tells the memory model how well you still know it.

  1. Day 3First recall, while it is fresh
  2. Day 7Second, a week on
  3. Day 18Last, when it has settled

Where it leads

Topics that build on Object lifecycle and references.

Previous in the module← Heap and stack
Next in the moduleGarbage collection →