advancedJVM Internals & Memory394 of 436
Why can OutOfMemoryError happen even when garbage collection is enabled?
Tests whether you know GC can only reclaim unreachable objects -- if live references still exist (a growing cache, a leaking listener list), the GC runs successfully every time but frees nothing useful, and the heap fills regardless.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response