garbage collection

Modern garbage collection

From the article: “The reality is that Go’s GC does not really implement any new ideas or research. As their announcement admits, it is a straightforward concurrent mark/sweep collector based on ideas from the 1970s. It is notable only because it has been designed to optimise for pause times at the cost of absolutely every other desirable characteristic in a GC.

A Java WeakHashMap class example

I ran across some Java source code today that I thought I should share. This code demonstrates how to use the Java WeakHashMap class, which can serve as a nice cache some times. I particularly like how this class responds to available memory and the Java garbage collection system.

Let me share the Java source code here first, and then I'll provide a description of how it works:

Java Runtime class - Invoke the Java garbage collector

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 Runtime freeMemory method in an example class.