Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-08-14 01:35:55 -0400
committerEike Stepper2012-08-14 01:35:55 -0400
commit6528637024f680f530a08d8d1830c23a99c2c460 (patch)
tree6a35cc95da4702bc6b72948f9f0d5eaf189c8bdb /plugins/org.eclipse.net4j.tests/src/org
parente9b7efc6ad64d6d92aeac6fa9e91c9c5e7f20a2f (diff)
downloadcdo-6528637024f680f530a08d8d1830c23a99c2c460.tar.gz
cdo-6528637024f680f530a08d8d1830c23a99c2c460.tar.xz
cdo-6528637024f680f530a08d8d1830c23a99c2c460.zip
Release heap space after test cases
Diffstat (limited to 'plugins/org.eclipse.net4j.tests/src/org')
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
index 6caa2d943a..483ecb774e 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
@@ -11,6 +11,7 @@
package org.eclipse.net4j.util.tests;
import org.eclipse.net4j.tests.bundle.OM;
+import org.eclipse.net4j.util.ReflectUtil;
import org.eclipse.net4j.util.concurrent.ConcurrencyUtil;
import org.eclipse.net4j.util.event.EventUtil;
import org.eclipse.net4j.util.event.IListener;
@@ -29,6 +30,8 @@ import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.om.trace.PrintTraceHandler;
import java.io.File;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
@@ -197,6 +200,15 @@ public abstract class AbstractOMTest extends TestCase
IOUtil.print(ex);
}
+ try
+ {
+ clearReferences(getClass());
+ }
+ catch (Exception ex)
+ {
+ IOUtil.print(ex);
+ }
+
if (!SUPPRESS_OUTPUT)
{
IOUtil.OUT().println();
@@ -204,6 +216,29 @@ public abstract class AbstractOMTest extends TestCase
}
}
+ protected void clearReferences(Class<?> c)
+ {
+ if (c != AbstractOMTest.class)
+ {
+ for (Field field : c.getDeclaredFields())
+ {
+ if (Modifier.isStatic(field.getModifiers()))
+ {
+ continue;
+ }
+
+ if (field.getType().isPrimitive())
+ {
+ continue;
+ }
+
+ ReflectUtil.setValue(field, this, null);
+ }
+
+ clearReferences(c.getSuperclass());
+ }
+ }
+
@Override
public void runBare() throws Throwable
{

Back to the top