# Java Level 9: JVM & Memory

> Level 9: JVM & Memory of the LoWisa Java course: Heap, Stack and Object Allocation, Garbage Collection, JVM Runtime Behaviour. 3 lessons and 9 ideas, each explained in one line.

JVM & Memory is level 9 of 16 of the [LoWisa Java course](/courses/java/). It has 3 lessons and 9 ideas. Below is every lesson and what it teaches, in one line each.

## Heap, Stack and Object Allocation

- **Stack and heap.** Each thread’s **stack** holds call frames and locals; every object lives on the shared heap.
- **Allocation is cheap.** JVM allocation is a pointer **bump**: creating objects is fast; keeping them alive is what costs.
- **OutOfMemoryError.** A heap that cannot grow throws **OutOfMemoryError**: usually a leak holding references, not truly big data.

## Garbage Collection

- **Reachability.** The collector frees objects no longer **reachable** from roots: you release references, never memory.
- **Generational collection.** Most objects die young, so heaps split into **generations**: young collections stay small and fast.
- **GC pauses.** Collectors trade throughput against **pause** time: modern ones keep pauses at milliseconds even on huge heaps.

## JVM Runtime Behaviour

- **JIT tiers.** Code starts interpreted, then tiers up through **JIT** compilation as it proves hot: benchmarks must warm up first.
- **JVM flags.** Flags size the **heap** and pick the collector: a deploy setting as real as any line of code.
- **Observing the JVM.** The JDK ships observers: jstat, **thread** dumps, flight recorder: the JVM will tell you what it is doing if asked.

## Before and after this level

- **Before:** [Level 8: Concurrency](/courses/java/level-8-concurrency/): Threads and Executors, Synchronisation and Shared State, Modern Concurrent Java.
- **Next:** [Level 10: Reflection & Language Infrastructure](/courses/java/level-10-reflection-and-language-infrastructure/): Annotations, Reflection, Dynamic Language Features and Trade-Offs.

In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See [Checkpoints and flashcards](/help/checkpoints-and-flashcards/).

## Frequently asked questions

### What does Java Level 9: JVM & Memory cover?

Heap, Stack and Object Allocation, Garbage Collection, JVM Runtime Behaviour: 3 lessons and 9 ideas.

### What should I know before this level?

The level before it, Level 8: Concurrency, which covers Threads and Executors, Synchronisation and Shared State, Modern Concurrent Java.

## Learn Java on your phone

The first level is free. LoWisa is on Google Play and the App Store.

---

Source: https://lowisa.dev/courses/java/level-9-jvm-and-memory/ · Updated 2026-11-16
