Bug 400073 - Indexer runs out of memory.
Fixed a soft memory leak caused by accumulation of data in
PDOM.fResultCache when several consecutive files fail to parse.
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java
index 9150a63..d9553b3 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java
@@ -1044,6 +1044,14 @@
}
if (th != null) {
swallowError(path, th);
+ // In case of a parsing error the result cache may not have been cleared.
+ // Clear if under a write lock to reduce interference with index readers.
+ fIndex.acquireWriteLock();
+ try {
+ fIndex.clearResultCache();
+ } finally {
+ fIndex.releaseWriteLock();
+ }
}
return null;
}