public class GCVerifier extends Object
Object testObject = new Object(); GCVerifier verifier = GCVerifier.create(testObject); testObject = null; // now there is no reference to the object anymore so it should be available for GC verifier.verify(); // this will throw an AssertionError if there is still a reference to the object somewhere
Modifier and Type | Method and Description |
---|---|
static GCVerifier |
create(Object instance)
Create a Verifier instance for the given Object.
|
static void |
forceGC()
This method can be used to "force" the garbage collection.
|
boolean |
isAvailableForGC() |
void |
verify() |
void |
verify(String message) |
public static GCVerifier create(Object instance)
instance
- the instance that is verified.GCVerifier
that can be used to verify the garbage collection of the given
instance.public void verify(String message)
public boolean isAvailableForGC()
true
if the object is availablepublic void verify()
public static void forceGC()
Copyright © 2016 Saxonia Systems AG. All rights reserved.