harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Salikh Zakirov <Salikh.Zaki...@Intel.com>
Subject Re: [classlib][swing][testing] Tests that depend on Garbage Collector
Date Thu, 07 Dec 2006 15:00:16 GMT
Richard wrote:
> According to the spec, "System.gc" only suggests JVM recycle unused
> objects, it does not guarantee that gc will be run.

Indeed, spec does not guarantee that garbage collection will be started,
however it strongly suggests to do so

	... When control returns from the method call [System.gc()], the Java Virtual
Machine has made a best effort to reclaim space from all discarded objects.

Since a number of tests explicitly assume that System.gc() will detect
objects eligible for finalization and reset weak reference, it would be very
inconvenient to break that expectation.

DRLVM gc_cc (current default garbage collector) does a special type of garbage
 collection on System.gc(), with a special purpose of identifying finalizable
objects and resetting weak references.

As far as I saw from -verbose:gc logs, JRockit and Hotspot do a full garbage
collection on System.gc(), so the assumption holds too.

View raw message