Forcing Garbage Collection to Avoid Memory Leaks

One of the best features of Java is that it performs automatic garbage collection, or memory management. Other languages such as C++ don't perform garbage collection automatically; instead they leave this task to the developers. Generally, the Java VM performs garbage collection when it needs more memory to continue execution. Even though you might write a program that loses an object reference, thereby making it a candidate for garbage collection, there is no guarantee that the garbage collection will occur at that time. This can be a problem for systems with memory constraints.

Java makes it possible for you to force garbage collection when needed. It is a simple process that involves using the ...

Get e-Commerce Applications Using Oracle8i and Java from Scratch 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.