diff --git a/src/java/org/apache/lucene/store/RAMDirectory.java b/src/java/org/apache/lucene/store/RAMDirectory.java index a1dcb67fd38..c68e767945e 100644 --- a/src/java/org/apache/lucene/store/RAMDirectory.java +++ b/src/java/org/apache/lucene/store/RAMDirectory.java @@ -180,7 +180,7 @@ public class RAMDirectory extends Directory implements Serializable { synchronized (this) { RAMFile existing = fileMap.get(name); if (existing!=null) { - sizeInBytes.addAndGet(existing.sizeInBytes); + sizeInBytes.addAndGet(-existing.sizeInBytes); existing.directory = null; } fileMap.put(name, file);