Prevent heap exhaustion due to test case heap leaks.

Change-Id: Ic35f314c93f95be39efcc2de434913a957ce203e
diff --git a/user/test/org/hibernate/jsr303/tck/util/TckCompileTestCase.java b/user/test/org/hibernate/jsr303/tck/util/TckCompileTestCase.java
index 8303e1e..7c80384 100644
--- a/user/test/org/hibernate/jsr303/tck/util/TckCompileTestCase.java
+++ b/user/test/org/hibernate/jsr303/tck/util/TckCompileTestCase.java
@@ -77,6 +77,17 @@
     validGroups = new Class<?>[]{ };
   }
 
+  @Override
+  protected void tearDown() throws Exception {
+    super.tearDown();
+    // Free all references to compiler internal objects to avoid heap exhaustion because the test
+    // runner keeps all test instances alive.
+    cache = null;
+    failOnErrorLogger =  null;
+    context = null;
+    validGroups =  null;
+  }
+
   private void assertUnableToComplete(
       Class<? extends ValidationException> expectedException,
       String expectedMessage, Generator generator, final String typeName) {