Note: This article is very old, like 1990s-old. In the 90s we did things like this, but manually manipulating theJava garbage collector in the 201x years is not a best-practice. That being said, I'm leaving this article here for historical reasons.
Summary: This article demonstrates how to use the Java
Runtime class to invoke the Java garbage collector, and shows the results of running the Java
freeMemory method in an example class.