garbage collection

Modern garbage collection alvin January 28, 2017 - 10:52am

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.

You may not need to use StringBuilder in Java any more alvin December 23, 2016 - 12:13pm

Here’s a short article on that explains why you might not need to use StringBuilder in Java any more.

Java JVM garbage collection and hot spot compiling alvin September 13, 2014 - 9:45am

I just ran across this info on the website and wanted to remember it here. The image shows a couple of flags that can be used to show Java JVM garbage collection and hot spot compiler information. In particular the second flag shows when the hot spot compiler is “done”.

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.