Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Recoskie2011-03-24 13:11:35 -0400
committerChris Recoskie2011-03-24 13:11:35 -0400
commite923b9a3c98bbc65427024c63316b210099c4138 (patch)
treee36919239a95ab81d090bcc118d35ff0c223587e /build/org.eclipse.cdt.make.core
parent4ab1f9b72f901f384cd4286894b9105e7ed45ff2 (diff)
downloadorg.eclipse.cdt-e923b9a3c98bbc65427024c63316b210099c4138.tar.gz
org.eclipse.cdt-e923b9a3c98bbc65427024c63316b210099c4138.tar.xz
org.eclipse.cdt-e923b9a3c98bbc65427024c63316b210099c4138.zip
Bug 205257 - CDTProject creation scalability issue
Diffstat (limited to 'build/org.eclipse.cdt.make.core')
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/PathInfo.java27
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java14
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java25
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SymbolEntry.java12
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java11
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigInfoFactory2.java10
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigProfileManager.java9
7 files changed, 72 insertions, 36 deletions
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/PathInfo.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/PathInfo.java
index 1c13c074c0..499a14ad67 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/PathInfo.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/PathInfo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Intel Corporation and others.
+ * Copyright (c) 2007, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Intel Corporation - Initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.make.core.scannerconfig;
@@ -14,6 +15,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
@@ -40,11 +42,32 @@ public final class PathInfo {
IPath[] macroFiles){
fIncludePaths = includePaths != null && includePaths.length != 0 ? (IPath[])includePaths.clone() : EMPTY_PATH_ARRAY;
fQuoteIncludePaths = quoteIncludePaths != null && quoteIncludePaths.length != 0 ? (IPath[])quoteIncludePaths.clone() : EMPTY_PATH_ARRAY;
- fSymbols = symbols != null && symbols.size() != 0 ? new HashMap<String, String>(symbols) : new HashMap<String, String>(0);
+ fSymbols = symbols != null && symbols.size() != 0 ? getInternedHashMap(symbols) : new HashMap<String, String>(0);
fIncludeFiles = includeFiles != null && includeFiles.length != 0 ? (IPath[])includeFiles.clone() : EMPTY_PATH_ARRAY;
fMacroFiles = macroFiles != null && macroFiles.length != 0 ? (IPath[])macroFiles.clone() : EMPTY_PATH_ARRAY;
}
+ /**
+ * Returns a new HashMap whereby all the strings used as keys and values are interned.
+ *
+ * @param oldMap
+ * @return HashMap<String, String>
+ */
+ protected HashMap<String, String> getInternedHashMap(Map<String, String> oldMap) {
+ if(oldMap == null)
+ return null;
+
+ if(oldMap.isEmpty())
+ return new HashMap<String, String>(oldMap);
+
+ HashMap<String, String> newMap = new HashMap<String, String>(oldMap.size());
+ for(String key : oldMap.keySet()) {
+ newMap.put(SafeStringInterner.safeIntern(key), SafeStringInterner.safeIntern(oldMap.get(key)));
+ }
+
+ return newMap;
+ }
+
/**
* Get include paths
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java
index 58194088b1..4e503a3534 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 QNX Software Systems and others.
+ * Copyright (c) 2004, 2011 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.make.internal.core.scannerconfig;
@@ -17,6 +18,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredScannerInfoSerializable;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerProjectDiscoveredPathInfo;
import org.eclipse.cdt.make.internal.core.scannerconfig.util.SymbolEntry;
@@ -73,7 +75,7 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
}
public synchronized void setIncludeMap(LinkedHashMap<String, Boolean> paths) {
- discoveredPaths = new LinkedHashMap<String, Boolean>(paths);
+ discoveredPaths = SafeStringInterner.safeIntern(new LinkedHashMap<String, Boolean>(paths));
activePaths = null;
}
@@ -98,7 +100,7 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
}
public synchronized void setSymbolMap(LinkedHashMap<String, SymbolEntry> symbols) {
- discoveredSymbols = new LinkedHashMap<String, SymbolEntry>(symbols);
+ discoveredSymbols = SafeStringInterner.safeIntern(new LinkedHashMap<String, SymbolEntry>(symbols));
activeSymbols = null;
}
@@ -109,7 +111,7 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
Map<String, String> aSymbols = getActiveSymbolsMap();
aSymbols.clear();
- aSymbols.putAll(ScannerConfigUtil.scSymbolEntryMap2Map(discoveredSymbols));
+ aSymbols.putAll(SafeStringInterner.safeIntern(ScannerConfigUtil.scSymbolEntryMap2Map(discoveredSymbols)));
}
private List<Path> getActivePathList() {
@@ -178,10 +180,10 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
while (child != null) {
if (child.getNodeName().equals(INCLUDE_PATH)) {
// Add the path to the property list
- includes.put( ((Element)child).getAttribute(PATH), Boolean.valueOf( ((Element)child).getAttribute(REMOVED)));
+ includes.put( SafeStringInterner.safeIntern(((Element)child).getAttribute(PATH)), Boolean.valueOf( ((Element)child).getAttribute(REMOVED)));
} else if (child.getNodeName().equals(DEFINED_SYMBOL)) {
// Add the symbol to the symbol list
- String symbol = ((Element)child).getAttribute(SYMBOL);
+ String symbol = SafeStringInterner.safeIntern(((Element)child).getAttribute(SYMBOL));
String removed = ((Element)child).getAttribute(REMOVED);
boolean bRemoved = (removed != null && removed.equals("true")); //$NON-NLS-1$
ScannerConfigUtil.scAddSymbolString2SymbolEntryMap(symbols, symbol, !bRemoved);
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java
index 5174c9d274..50e6724729 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others.
+ * Copyright (c) 2004, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,6 +17,7 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.internal.core.resources.ResourceLookup;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -83,7 +84,7 @@ public class CCommandDSC {
{
String value = option.getValue();
value = CygpathTranslator.translateIncludePaths(project, Collections.singletonList(value)).get(0);
- value = makeRelative(project, new Path(value)).toOSString();
+ value = SafeStringInterner.safeIntern(makeRelative(project, new Path(value)).toOSString());
option = new KVStringPair(option.getKey(), value);
}
compilerCommand.add(option);
@@ -322,8 +323,8 @@ public class CCommandDSC {
NodeList optionList = descElem.getElementsByTagName(OPTION_ELEM);
for (int i = 0; i < optionList.getLength(); ++i) {
Element optionElem = (Element) optionList.item(i);
- String key = optionElem.getAttribute(KEY_ATTR);
- String value = optionElem.getAttribute(VALUE_ATTR);
+ String key = SafeStringInterner.safeIntern(optionElem.getAttribute(KEY_ATTR));
+ String value = SafeStringInterner.safeIntern(optionElem.getAttribute(VALUE_ATTR));
KVStringPair option = new KVStringPair(key, value);
addSCOption(option);
}
@@ -340,14 +341,14 @@ public class CCommandDSC {
String quote = siItemElem.getAttribute(QUOTE_INCLUDE_ATTR);
if (kind.equals("INCLUDE_PATH")) { //$NON-NLS-1$
if (quote.equals("true")) { //$NON-NLS-1$
- quoteIncludes.add(value);
+ quoteIncludes.add(SafeStringInterner.safeIntern(value));
}
else {
includes.add(value);
}
}
else if (kind.equals("SYMBOL_DEFINITION")) { //$NON-NLS-1$
- symbols.add(value);
+ symbols.add(SafeStringInterner.safeIntern(value));
}
}
setDiscovered(true);
@@ -365,13 +366,13 @@ public class CCommandDSC {
String key = optionPair.getKey();
String value = optionPair.getValue();
if (key.equals(SCDOptionsEnum.INCLUDE.toString()) || key.equals(SCDOptionsEnum.ISYSTEM.toString())) {
- includes.add(value);
+ includes.add(SafeStringInterner.safeIntern(value));
}
else if (key.equals(SCDOptionsEnum.IQUOTE.toString())) {
- quoteincludes.add(value);
+ quoteincludes.add(SafeStringInterner.safeIntern(value));
}
else if (key.equals(SCDOptionsEnum.DEFINE.toString())) {
- symbols.add(value);
+ symbols.add(SafeStringInterner.safeIntern(value));
}
}
setIncludes(includes);
@@ -411,7 +412,7 @@ public class CCommandDSC {
for (Iterator<String> iter=paths.iterator(); iter.hasNext(); ) {
String path = iter.next();
path = makeRelative(project, new Path(path)).toOSString();
- list.add(path);
+ list.add(SafeStringInterner.safeIntern(path));
}
return list;
}
@@ -429,7 +430,7 @@ public class CCommandDSC {
}
// path = new File(project.getLocation().toOSString(), path).getAbsolutePath();
}
- return path;
+ return SafeStringInterner.safeIntern(path);
}
public static List<String> makeAbsolute(IProject project, List<String> paths) {
@@ -437,7 +438,7 @@ public class CCommandDSC {
for (Iterator<String> iter=paths.iterator(); iter.hasNext(); ) {
String path = iter.next();
path = makeAbsolute(project, path);
- list.add(path);
+ list.add(SafeStringInterner.safeIntern(path));
}
return list;
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SymbolEntry.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SymbolEntry.java
index df073cda61..4ff66c2014 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SymbolEntry.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SymbolEntry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
+ * Copyright (c) 2004, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,6 +16,8 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
+
/**
* Represents a symbol definition with possible multiple values
@@ -31,15 +33,15 @@ public class SymbolEntry {
private Map<String, Boolean> values; // Values can be either in the active (selected) group or in the removed group
public SymbolEntry(String name, String value, boolean active) {
- this.name = name;
+ this.name = SafeStringInterner.safeIntern(name);
if (values == null) {
values = new LinkedHashMap<String, Boolean>(1);
}
- values.put(value, Boolean.valueOf(active));
+ values.put(SafeStringInterner.safeIntern(value), Boolean.valueOf(active));
}
public boolean add(String value, boolean active) {
- Boolean old= values.put(value, Boolean.valueOf(active));
+ Boolean old= values.put(SafeStringInterner.safeIntern(value), Boolean.valueOf(active));
return old == null || old.booleanValue() != active;
}
@@ -125,6 +127,6 @@ public class SymbolEntry {
}
buffer.append('\n');
}
- return buffer.toString();
+ return SafeStringInterner.safeIntern(buffer.toString());
}
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java
index 61ee97fa0f..ab5f2e5ea8 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others.
+ * Copyright (c) 2004, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,6 +25,7 @@ import java.util.SortedSet;
import java.util.TreeSet;
import java.util.Map.Entry;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector3;
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner;
@@ -685,8 +686,8 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
List<String> symbols = cmd.getSymbols();
Map<String, String> definedSymbols = new HashMap<String, String>(symbols.size());
for (String symbol : symbols) {
- String key = ScannerConfigUtil.getSymbolKey(symbol);
- String value = ScannerConfigUtil.getSymbolValue(symbol);
+ String key = SafeStringInterner.safeIntern(ScannerConfigUtil.getSymbolKey(symbol));
+ String value = SafeStringInterner.safeIntern(ScannerConfigUtil.getSymbolValue(symbol));
definedSymbols.put(key, value);
}
return definedSymbols;
@@ -903,8 +904,8 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
if (cmd.isDiscovered()) {
List<String> discovered = cmd.getSymbols();
for (String symbol : discovered) {
- String key = ScannerConfigUtil.getSymbolKey(symbol);
- String value = ScannerConfigUtil.getSymbolValue(symbol);
+ String key = SafeStringInterner.safeIntern(ScannerConfigUtil.getSymbolKey(symbol));
+ String value = SafeStringInterner.safeIntern(ScannerConfigUtil.getSymbolValue(symbol));
symbols.put(key, value);
}
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigInfoFactory2.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigInfoFactory2.java
index 0e7f57929e..db1b2df83e 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigInfoFactory2.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigInfoFactory2.java
@@ -26,6 +26,7 @@ import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICDescriptor;
import org.eclipse.cdt.core.settings.model.ICStorageElement;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo;
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
@@ -510,6 +511,7 @@ public class ScannerConfigInfoFactory2 {
this.autoDiscoveryEnabled = base.autoDiscoveryEnabled;
this.problemReportingEnabled = base.problemReportingEnabled;
this.selectedProfile = ScannerConfigProfileManager.NULL_PROFILE_ID.equals(profileId) ? base.selectedProfile : profileId;
+ this.selectedProfile = SafeStringInterner.safeIntern(this.selectedProfile);
this.profileOptionsMap.putAll(base.profileOptionsMap);
for (Map.Entry<String, ProfileOptions> entry : profileOptionsMap.entrySet()) {
ProfileOptions basePo = entry.getValue();
@@ -556,7 +558,7 @@ public class ScannerConfigInfoFactory2 {
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#setSelectedProfileId(java.lang.String)
*/
public void setSelectedProfileId(String profileId) {
- selectedProfile = setDirty(selectedProfile, profileId);
+ selectedProfile = SafeStringInterner.safeIntern(setDirty(selectedProfile, profileId));
// if (isDirty) {
// try {
// load();
@@ -897,6 +899,7 @@ public class ScannerConfigInfoFactory2 {
selectedProfile = (profileId == ScannerConfigProfileManager.NULL_PROFILE_ID)
? sc.getAttribute(SELECTED_PROFILE_ID)
: profileId;
+ selectedProfile = SafeStringInterner.safeIntern(selectedProfile);
problemReportingEnabled = Boolean.valueOf(
sc.getAttribute(PROBLEM_REPORTING_ENABLED)).booleanValue();
performMigration = false;
@@ -925,7 +928,7 @@ public class ScannerConfigInfoFactory2 {
autoDiscoveryEnabled = oldInfo.isAutoDiscoveryEnabled();
problemReportingEnabled = oldInfo.isSIProblemGenerationEnabled();
// effectively a PerProject profile
- selectedProfile = profileId;
+ selectedProfile = SafeStringInterner.safeIntern(profileId);
ProfileOptions po = new ProfileOptions();
po.buildOutputFileActionEnabled = false;
@@ -1171,10 +1174,11 @@ public class ScannerConfigInfoFactory2 {
selectedProfile = (ScannerConfigProfileManager.NULL_PROFILE_ID.equals(profileId)) ?
getString(prefix + SCANNER_CONFIG_SELECTED_PROFILE_ID_SUFFIX) :
profileId;
+ selectedProfile = SafeStringInterner.safeIntern(selectedProfile);
problemReportingEnabled = getBoolean(prefix + SCANNER_CONFIG_PROBLEM_REPORTING_ENABLED_SUFFIX);
if (ScannerConfigProfileManager.NULL_PROFILE_ID.equals(selectedProfile) && !useDefaults) {
// get the default value
- selectedProfile = prefs.getDefaultString(prefix + SCANNER_CONFIG_SELECTED_PROFILE_ID_SUFFIX);
+ selectedProfile = SafeStringInterner.safeIntern(prefs.getDefaultString(prefix + SCANNER_CONFIG_SELECTED_PROFILE_ID_SUFFIX));
}
List<String> profileIds = ScannerConfigProfileManager.getInstance().getProfileIds(context);
profileOptionsMap = new LinkedHashMap<String, ProfileOptions>(profileIds.size());
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigProfileManager.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigProfileManager.java
index 3d1f5ac30c..167b67a8fe 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigProfileManager.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigProfileManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others.
+ * Copyright (c) 2004, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.make.internal.core.scannerconfig2;
+import java.lang.ref.SoftReference;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -116,10 +117,12 @@ public final class ScannerConfigProfileManager {
synchronized (fLock) {
// is the project's profile already loaded?
Map<InfoContext, Object> map = getProfileMap(project, true);
- SCProfileInstance profileInstance = (SCProfileInstance) map.get(context);
+ SoftReference<SCProfileInstance> profileInstanceReference = (SoftReference<SCProfileInstance>) map.get(context);
+ SCProfileInstance profileInstance = profileInstanceReference != null ? profileInstanceReference.get() : null;
+
if (profileInstance == null || !profileInstance.getProfile().getId().equals(profileId)) {
profileInstance = new SCProfileInstance(project, context, getSCProfileConfiguration(profileId));
- map.put(context, profileInstance);
+ map.put(context, new SoftReference<SCProfileInstance>(profileInstance));
}
return profileInstance;
}

Back to the top