Skip to content

Commit

Permalink
Bug 432839 - Fix out of memory condition with Qt projects.
Browse files Browse the repository at this point in the history
Turn the cache in QtPDOMLinkage into a WeahHashMap.

Change-Id: I261d3aec5ee6b7537c4bfaa204dadd85b686140c
Reviewed-on: https://git.eclipse.org/r/25064
Reviewed-by: Doug Schaefer <dschaefer@qnx.com>
Tested-by: Doug Schaefer <dschaefer@qnx.com>
(cherry picked from commit b12b65b)
Reviewed-on: https://git.eclipse.org/r/25069
  • Loading branch information
Doug Schaefer committed Apr 15, 2014
1 parent 84289fb commit e907795
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -10,8 +10,8 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.WeakHashMap;

import org.eclipse.cdt.core.dom.ILinkage;
import org.eclipse.cdt.core.dom.ast.IASTName;
Expand Down Expand Up @@ -58,7 +58,7 @@ public long getRecord(long baseRec) {
// The version that has been read from/written to the persisted file.
private int version;

private final Map<IQtASTName, PDOMBinding> cache = new HashMap<IQtASTName, PDOMBinding>();
private final Map<IQtASTName, PDOMBinding> cache = new WeakHashMap<IQtASTName, PDOMBinding>();

public QtPDOMLinkage(PDOM pdom, long record) throws CoreException {
super(pdom, record);
Expand Down Expand Up @@ -166,6 +166,9 @@ public PDOMBinding getBinding(IQtASTName qtAstName) throws CoreException {
//
// I don't think this needs to be thread-safe, because things are only added from
// the single indexer task.
//
// Doug: The cache is causing out of memory conditions. Commenting out for now.
//
PDOMBinding pdomBinding = null;
pdomBinding = cache.get(qtAstName);
if (pdomBinding != null)
Expand Down

0 comments on commit e907795

Please sign in to comment.