Index: lucene/CHANGES.txt =================================================================== --- lucene/CHANGES.txt (revision 1062641) +++ lucene/CHANGES.txt (working copy) @@ -362,6 +362,9 @@ internally, it now calls Similarity.idfExplain(Collection, IndexSearcher). (Robert Muir) +* LUCENE-2693: RAM used by IndexWriter was slightly incorrectly computed. + (Jason Rutherglen via Shai Erera) + New features * LUCENE-2128: Parallelized fetching document frequencies during weight Index: lucene/src/java/org/apache/lucene/index/SegmentDeletes.java =================================================================== --- lucene/src/java/org/apache/lucene/index/SegmentDeletes.java (revision 1062641) +++ lucene/src/java/org/apache/lucene/index/SegmentDeletes.java (working copy) @@ -140,8 +140,11 @@ } public void addQuery(Query query, int docIDUpto) { - queries.put(query, docIDUpto); - bytesUsed.addAndGet(BYTES_PER_DEL_QUERY); + Integer current = queries.put(query, docIDUpto); + // increment bytes used only if the query wasn't add so far. + if (current == null) { + bytesUsed.addAndGet(BYTES_PER_DEL_QUERY); + } } public void addDocID(int docID) {