Java GC reclaims unreachable graphs automatically—so a Java memory leak happens whenever dead logical data remains strongly reachable forever! Recognizing the exact OutOfMemoryError message immediately tells you whether to inspect heap dumps, Metaspace classloaders, thread stacks or direct byte buffers.
More lessons in Complete Core Java