[kaffe] Kaffe CVS: kaffe hkraemer

Timothy Stack stack at cs.utah.edu
Tue May 20 06:17:02 PDT 2003


On Monday, May 19, 2003, at 01:03  PM, Helmer Krämer wrote:
>
> - ClassGC:
>
> This test fails because a "duplicate name" error occurs,
> which means that a classloader tries to defineClass() a
> class it has already loaded and defined before (or at
> least tried to do so).
>
> This test creates its own classloader and loads a class
> called "ClassGCTest" with that classloader. Afterwards,
> the test runs the garbage collector (while still referencing
> the classloader) and thereafter tries to load another class
> called "ClassGCTestLater" (via its own classloader). This
> class in turn depends on the class "ClassGCTest", which
> causes the vm to again load the "ClassGCTest" class via
> the test's classloader. Since the test's classloader then
> simply loads and defines the class again, the "duplicate name"
> error occurs.
>
> The only way how this test can succeed is that the "ClassGCTest"
> class gets gc'ed during the invocation of the garbage collector.
> This however cannot happen in this case: First of all, every
> classloader references the classes it has already loaded and
> defined through its loadedClasses hashtable. Since the classloader
> that loaded and defined the "ClassGCTest" class (and thus keeps
> a reference to it) is still referenced during the garbage collection,
> the classloader itself and thus the "ClassGCTest" class cannot be
> gc'ed, which in turn means that this test can't succeed.
>
> So I'm either missing something obvious or I don't have a clue
> why this test succeeded before.

Look again, its a loop and only one of the loaders thats created must 
be collected for the test to succeed.

> Greetings,
> Helmer

tim





More information about the kaffe mailing list