Code RoomJava OutOfMemory under load
HardPrep Room Coding #4057

Java OutOfMemory under load

Vibe & agenticAlgorithms & data structuresSenior–Staff~21 min

You ask an AI to fix a Java service throwing intermittent `OutOfMemoryError` under load. It suggests bumping `-Xmx` from 2g to 4g; OOM comes back. You re-prompt, it adds `System.gc()` calls 'to free memory sooner'; no change. Third try it switches the GC to G1 and bumps heap to 8g; OOMs still recur, just less often. The model is treating every OOM as 'not enough heap.' How do you recognize it's stuck and reset?

Implement
classify_heap_trend(post_gc_used_mb: list[int], heap_max_mb: int) → str
Examples
in[[900,1200,1500,1800],4096]out"leak"
in[[3700,3650,3720,3690],4096]out"undersized"
in[[400,380,410,395],4096]out"healthy"
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.

0:00 of about 21 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.