Interview replay

Full round replay — Metaspace

10 minsenior315 yrs

Timed verbal replay with pass/fail criteria per follow-up.

How to run this

Answer out loud, timed. Do not read the entry first. Then compare against "The Answer" and "Interviewer's Next Move" and mark yourself.

The opener

What replaced PermGen, and why?

Budget: 45 seconds. Going long here is itself a fail signal.

Follow-ups

  1. 1. “So is the PermGen problem solved?

    Testing: The best question on this topic — most people say yes.

    Scoring

    Pass: The ceiling is gone, the leak is not. Metaspace is unbounded by default, so the same leak grows into native memory until the kernel kills the process — no Java error, no heap dump. Argues that is a worse failure mode.

    Fail: 'Yes, Metaspace grows automatically' as though that were the fix.

  2. 2. “Where did static variables go?

    Testing: Almost everyone says Metaspace.

    Scoring

    Pass: To the heap, inside the java.lang.Class mirror — JEP 122 moved statics and interned strings there. Only the metadata went to Metaspace.

    Fail: 'Metaspace', with no awareness that only metadata moved.

  3. 3. “When is class metadata actually unloaded?

    Testing: Per loader, not per class — the mechanism behind every leak here.

    Scoring

    Pass: When the whole class loader becomes unreachable. A class holds its loader, the loader holds its classes, instances hold their class — all or nothing. The app class loader never goes while the JVM runs.

    Fail: 'When the class is no longer used' or 'the GC handles it'.

  4. 4. “What is a ClassLoader leak, and how would you find one?

    Testing: Have they actually diagnosed one?

    Scoring

    Pass: A redeploy makes a new loader and a second copy of every class; one outside reference — a ThreadLocal on a container thread, a registered JDBC driver, an unstopped thread — pins the old one. jcmd VM.classloader_stats, or a class histogram showing N copies of one name.

    Fail: Knows the term, has no diagnostic step.

  5. 5. “A service is OOMKilled with no OutOfMemoryError and a healthy heap dump. Where do you look?

    Testing: Can they reason about memory outside the heap?

    Scoring

    Pass: Outside the heap: Metaspace, thread stacks, code cache, direct buffers. Notes that a healthy heap dump is a positive signal for Metaspace, because classes are not heap objects. Turns on native memory tracking.

    Fail: 'Increase the heap' or keeps looking at the dump.

  6. 6. “Would you set -XX:MaxMetaspaceSize? Argue it.

    Testing: Judgement about failure modes rather than a rule.

    Scoring

    Pass: Yes — it converts an invisible OOMKill into a Java error that names the problem and can trigger a dump. Notes the counter-argument (it caused the outage) and answers it: it exposed the leak rather than causing it.

    Fail: 'No, it's unbounded for a reason' with no failure-mode reasoning.

Score yourself

6/6 — you can hold this topic at senior level 4-5 — solid; reread "Interviewer's Next Move" 0-3 — reread "Understand It" and redo the Challenge tier

← Back to What replaced PermGen, and why?