8

Memory Leaks

Memory leaks occur as a result of improper memory management and can directly impact the performance of an application. These leaks occur when memory is improperly deallocated or when it is allocated but becomes inaccessible. Improper memory management not only negatively impacts performance but can also hinder scalability, result in system crashes due to OutOfMemoryError, and ruin the user experience. Many developers implicitly trust Java’s garbage collector (covered in Chapter 1) to manage memory while their applications run; however, despite the garbage collector’s incredible capabilities, memory leaks are a persistent issue.

The garbage collector is not faulty; rather, memory leaks occur when the garbage collector is unable ...

Get High Performance with Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.