I’ve a hard time understanding the following:
“The Java language specification allows a dummy gc() method.”
Why would the standard do this?
Its effectively making a very important feature of java optional.
This would also mean my same program will behave differently on two different JVM implementations !!! Something totally against Java’s important feature of portability.
The GC is not made optional by that in Java. What is made optional is an explicit garbage collection, triggered by a call to
gc(). And this is completely acceptable, since explicitly triggering a garbage collection is rarely necessary and interferes with the function of a modern garbage collector.