Level 1 · Apprentice0 XP
Where objects live, how they are freed, and how to read the symptoms.
Step 1 / 5
ProblemA service runs well for days, gets slower, then dies with OutOfMemoryError. 'But Java has garbage collection.' It does, and it cannot free what your code still points to.
← → step
Before this: CompletableFuture and virtual threads
🛠️ Your turn
Reading is not the skill, doing is. Try for ten minutes before you open the hint. Getting stuck first is what makes the solution stick.
1.Write a program that adds objects to a static list forever. Run it with -Xmx64m and read the OutOfMemoryError. Run it again with -XX:+HeapDumpOnOutOfMemoryError, open the dump in a tool such as VisualVM or Eclipse MAT, and find which object holds the memory.