Help, My Java Object Vanished (and the GC Is Not at Fault)

A ghost bug in Java, a detective story, and a repost squabble

TLDR: A Java dev tracked a “vanishing object” bug tied to a new compact header change, proving the garbage collector wasn’t to blame. Readers loved the detective-style write‑up, while a small chorus grumbled about a Hacker News repost—meta drama that amplified a genuinely useful debugging lesson

Java dev Paul Hübner tells a wild, CSI: Code tale: objects in his program started vanishing, and it wasn’t the garbage collector (the auto-cleaner) to blame. He was tweaking the tiny “mark word” in an object’s header to fit JEP 450 for Project Valhalla, and chaos ensued. The post is part tutorial, part thriller, complete with summaries and bad ASCII art, and the community ate it up.

Top comment energy: pure love for a clean, step-by-step debugging story. One reader swooned: “Best debugging article I’ve read in quite a while.” Meanwhile, the meta-drama arrived fast—another commenter pointed to a Hacker News repost, and the familiar repost police vs let-good-content-live feud kicked off. Some cheered, “More eyes on a great write-up,” while others rolled theirs at déjà vu.

Jokes flew: “Java Houdini,” “GC was framed,” and “Valhalla? So we’re putting objects in Thor’s basement now?” Even non-Java folks felt like they were in on the mystery, thanks to the plain-English breakdown. The net vibe: smart, accessible debugging wins hearts, and a little cross-post spice makes the thread pop. Read for the ghost hunt, stay for the comments.

Key Points

  • A HotSpot JVM developer observed Java objects and classes disappearing during tests for a new feature while working on OpenJDK.
  • The work involved changing the markWord to comply with JEP 450 (Compact Object Headers) for Project Valhalla.
  • The article provides a primer on Java, the JVM, HotSpot, and JIT compilation to contextualize the issue.
  • JDK 24’s JEP 450 compacts object headers by embedding the class pointer into the mark word, reducing headers to 64 bits on 64-bit systems.
  • The mark word’s least-significant bits encode lock state (tag bits), a self-forwarding bit, age bits for GC, and Valhalla-reserved bits.

Hottest takes

"Best debugging article I've read in quite a while" — abstractspoon
"Also posted previously at https://news.ycombinator.com/item?id=46077637" — aw1621107
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.