From ad84b66412db464615e1325c8dcb82b49c6314fc Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 11 Feb 2015 20:12:03 +0100 Subject: [PATCH] sweep smart pointer infrastructure on low memory (IDEA-136341) --- .../smartPointers/SmartPointerManagerImpl.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/platform/core-impl/src/com/intellij/psi/impl/smartPointers/SmartPointerManagerImpl.java b/platform/core-impl/src/com/intellij/psi/impl/smartPointers/SmartPointerManagerImpl.java index dc66978ba613..2a8f8d0eb960 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/smartPointers/SmartPointerManagerImpl.java +++ b/platform/core-impl/src/com/intellij/psi/impl/smartPointers/SmartPointerManagerImpl.java @@ -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 ourQueue = new ReferenceQueue(); + @SuppressWarnings("unused") private static final LowMemoryWatcher ourWatcher = LowMemoryWatcher.register(new Runnable() { + @Override + public void run() { + processQueue(); + } + }); + + private final Project myProject; private final Key> POINTERS_KEY; private final Key POINTERS_ARE_FASTENED_KEY;