1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 01:15:29 +02:00

Bug 432839 - Fix out of memory condition with Qt projects.

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>
This commit is contained in:
Doug Schaefer 2014-04-15 11:17:12 -04:00
parent 995e0da76c
commit b12b65bfb8

View file

@ -10,8 +10,8 @@ package org.eclipse.cdt.internal.qt.core.pdom;
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;
@ -58,7 +58,7 @@ public class QtPDOMLinkage extends PDOMLinkage {
// 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);
@ -166,6 +166,9 @@ public class QtPDOMLinkage extends PDOMLinkage {
//
// 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)