If you want to test the GC of something, don't need to use an
aggressive algorithm that performs System.gc() and runFinalizaion() in
a loop that's iterated based on the amount of memory that was freed? I
seem to recall seeing such an algorithm in one of the original Sun
Java books.
-Nathan
On 12/6/06, Ivanov, Alexey A <[EMAIL PROTECTED]> wrote:
Hi all,
There are three tests in Swing which depend on Garbage Collector. That is GC is
_really_ run as the result of System.gc() call.
These tests are:
* javax.swing.text.GapContent_InternalTest.testPositionGC(),
* javax.swing.text.StyleContextTest.testCollectGarbageInCache(), and
* javax.swing.text.StyleContextTest.testCollectGarbageInCacheFont().
What they check is:
* j.s.t.Position instances are removed from the internal list of GapContent
when an instance is not used any more. (PhantomReference and WeakReference are
involved.)
* cached AttributeSets are removed from it (WeakHashMap).
* cached Fonts are removed from the corresponding cache (WeakReference).
These tests always pass when run on the RI. They were used to ensure caching
works fine. None of VMs in Harmony seem to perform garbage collection when
System.gc() is called, and mostly these tests fail. However, sometimes they
pass.
How can we handle these tests? Just remove them?
Thank you in advance,
--
Alexey A. Ivanov
Intel EnterpriseSolutions SoftwareDivision