I'd like to hear from someone with access to the Sun
Java team, but I think that the gc in the jvm that comes with the j2se sdk is very aggressive in calling finalize() and destroying objects in order to help out students writing
test programs like the one in this
thread.
A production gc might wait until there is more to clean up.
Also, remember that the production use of calling System.gc() is not to prevent an out of memory condition - we are guaranteed that the jvm will take care of that - but to prevent any slowdown in processing during routine garbage collection from happening at an inconvenient time in a real time program.
The official specification about the unpredictability of gc does not forbid a particular implementation from being more predictable. Of course, the
SCJP exam is based on the JLS and API
doc and our answers should be as well.