// we have to remove all references here to reduce memory consumption.
//
// Proper fix would be to remove references between QueryCache and GENodeQueryManagers.
+
+ // Clearing explorerContext replaces GECache with dummy implementation, which makes node disposal much faster.
+ explorerContext.close();
if (rootNode != null) {
- rootNode.dispose();
+ // Using fastDispose bypasses item removal from nodeMap, which is cleared later.
+ rootNode.fastDispose();
rootNode = null;
}
- explorerContext.dispose();
+ explorerContext.dispose();
explorerContext = null;
processors.clear();
detachPrimitiveProcessors();
}
resourceManager.dispose();
resourceManager = null;
-
- contextToNodeMap.clear(); // should be empty at this point.
+ contextToNodeMap.clear();
contextToNodeMap = null;
if (postSelectionProvider != null) {
postSelectionProvider.dispose();
}
};
+ public void close() {
+ cache.dispose();
+ cache = new DummyCache();
+ scheduleList.clear();
+ autoExpanded.clear();
+ }
+
@Override
public void dispose() {
cache.dispose();
final HashMap<GECacheKey, IGECacheEntry> entries = new HashMap<GECacheKey, IGECacheEntry>();
final HashMap<GECacheKey, Set<UIElementReference>> treeReferences = new HashMap<GECacheKey, Set<UIElementReference>>();
final HashMap<NodeContext, Set<GECacheKey>> keyRefs = new HashMap<NodeContext, Set<GECacheKey>>();
+ private TObjectIntHashMap<NodeContext> references = new TObjectIntHashMap<NodeContext>();
/**
* This single instance is used for all get operations from the cache. This
return references.get(context) > 0;
}
- private TObjectIntHashMap<NodeContext> references = new TObjectIntHashMap<NodeContext>();
+
@Override
public void incRef(NodeContext context) {