Minimize memory leaks in Java
by, 01-08-2012 at 01:46 PM (2499 Views)
The main causes for memory leaks in java are poor design with invalid references. Garbage collector is not able to claim those objects.
Following steps help you to detect memory leaks in your application.
• Use tools like JProbe, OptimizeIt.
• Use operating system process monitors.
• Override totalMemory() and freeMemory() methods in the Java Runtime class.
Following steps help you to minimize memory leaks in your application.
• Keep in mind object’s life cycle while designing applications.
• Set the root of a collection to null so that garbage collection can collect it.
• Use weak references.