From 88895e7eef6884b45bde8bc4294d36fbdbee9ae6 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Thu, 7 May 2009 18:23:52 +0000 Subject: [PATCH] encourage early GC git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17832 71c3de6d-444a-0410-be80-ed276b4c234a --- .../src/main/java/org/jvnet/hudson/test/HudsonTestCase.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java b/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java index 00acff09f5..8440496851 100644 --- a/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java +++ b/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java @@ -226,6 +226,12 @@ public abstract class HudsonTestCase extends TestCase { env.dispose(); ExtensionList.clearLegacyInstances(); DescriptorExtensionList.clearLegacyInstances(); + + // Hudson creates ClassLoaders for plugins that hold on to file descriptors of its jar files, + // but because there's no explicit dispose method on ClassLoader, they won't get GC-ed until + // at some later point, leading to possible file descriptor overflow. So encourage GC now. + // see http://bugs.sun.com/view_bug.do?bug_id=4950148 + System.gc(); } protected void runTest() throws Throwable {