diff --git a/platform/util/src/com/intellij/util/io/CompressedAppendableFile.java b/platform/util/src/com/intellij/util/io/CompressedAppendableFile.java index 626ebeee5cca..e5e69ac6710e 100644 --- a/platform/util/src/com/intellij/util/io/CompressedAppendableFile.java +++ b/platform/util/src/com/intellij/util/io/CompressedAppendableFile.java @@ -35,7 +35,7 @@ import java.util.Arrays; */ public class CompressedAppendableFile { private final File myBaseFile; - @SuppressWarnings({"FieldCanBeLocal", "unused"}) private final LowMemoryWatcher myLowMemoryWatcher; + private final LowMemoryWatcher myLowMemoryWatcher; // force will clear the buffer and reset the position private byte[] myNextChunkBuffer; @@ -74,6 +74,10 @@ public class CompressedAppendableFile { @Override public void run() { dropCaches(); + + synchronized (ourDecompressedCache) { + ourDecompressedCache.clear(); + } } }); } @@ -460,6 +464,7 @@ public class CompressedAppendableFile { public synchronized void dispose() { force(); + myLowMemoryWatcher.stop(); } public synchronized long length() { @@ -482,19 +487,9 @@ public class CompressedAppendableFile { private static class FileChunkReadCache extends SLRUMap, byte[]> { private final FileChunkKey myKey = new FileChunkKey(null, 0); - @SuppressWarnings({"FieldCanBeLocal", "unused"}) private final LowMemoryWatcher myLowMemoryWatcher; FileChunkReadCache() { super(64, 64); - - myLowMemoryWatcher = LowMemoryWatcher.register(new Runnable() { - @Override - public void run() { - synchronized (ourDecompressedCache) { - ourDecompressedCache.clear(); - } - } - }); } @NotNull