diff --git a/platform/util/src/com/intellij/util/GCUtil.java b/platform/testFramework/src/com/intellij/util/GCUtil.java similarity index 96% rename from platform/util/src/com/intellij/util/GCUtil.java rename to platform/testFramework/src/com/intellij/util/GCUtil.java index b1a4da43afa3..6c1762a7f2f2 100644 --- a/platform/util/src/com/intellij/util/GCUtil.java +++ b/platform/testFramework/src/com/intellij/util/GCUtil.java @@ -16,6 +16,7 @@ package com.intellij.util; import com.intellij.util.containers.ContainerUtil; +import org.jetbrains.annotations.TestOnly; import java.lang.ref.ReferenceQueue; import java.lang.ref.SoftReference; @@ -27,6 +28,7 @@ public class GCUtil { * Try to force VM to collect all the garbage along with soft- and weak-references. * Method doesn't guarantee to succeed, and should not be used in the production code. */ + @TestOnly public static void tryForceGC() { tryGcSoftlyReachableObjects(); WeakReference weakReference = new WeakReference(new Object()); @@ -40,6 +42,7 @@ public class GCUtil { * Try to force VM to collect soft references if possible. * Method doesn't guarantee to succeed, and should not be used in the production code. */ + @TestOnly public static void tryGcSoftlyReachableObjects() { ReferenceQueue q = new ReferenceQueue(); SoftReference ref = new SoftReference(new Object(), q);