sweep smart pointer infrastructure on low memory (IDEA-136341)
authorpeter <peter@jetbrains.com>
Wed, 11 Feb 2015 19:12:03 +0000 (20:12 +0100)
committerpeter <peter@jetbrains.com>
Wed, 11 Feb 2015 19:23:58 +0000 (20:23 +0100)
platform/core-impl/src/com/intellij/psi/impl/smartPointers/SmartPointerManagerImpl.java

index dc66978ba613647859ed96537ab5064edfbf16e3..2a8f8d0eb96024222b02169ad4fbffa2ce4053e8 100644 (file)
@@ -22,10 +22,7 @@ import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.RangeMarker;
 import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Key;
-import com.intellij.openapi.util.ProperTextRange;
-import com.intellij.openapi.util.Segment;
-import com.intellij.openapi.util.TextRange;
+import com.intellij.openapi.util.*;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.*;
 import com.intellij.psi.impl.PsiManagerEx;
@@ -47,10 +44,16 @@ import java.util.Set;
 
 public class SmartPointerManagerImpl extends SmartPointerManager {
   private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.smartPointers.SmartPointerManagerImpl");
-
-  private final Project myProject;
   private static final Object lock = new Object();
   private static final ReferenceQueue<SmartPointerEx> ourQueue = new ReferenceQueue<SmartPointerEx>();
+  @SuppressWarnings("unused") private static final LowMemoryWatcher ourWatcher = LowMemoryWatcher.register(new Runnable() {
+    @Override
+    public void run() {
+      processQueue();
+    }
+  });
+
+  private final Project myProject;
   private final Key<Set<PointerReference>> POINTERS_KEY;
   private final Key<Boolean> POINTERS_ARE_FASTENED_KEY;