View | Details | Raw Unified | Return to bug 292267 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/core/internal/localstore/UnifiedTreeNode.java (+12 lines)
Lines 7-12 Link Here
7
 * 
7
 * 
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Martin Oberhuber (Wind River) - [292267] OutOfMemoryError due to leak in UnifiedTree
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.core.internal.localstore;
12
package org.eclipse.core.internal.localstore;
12
13
Lines 108-113 Link Here
108
		this.fileInfo = info;
109
		this.fileInfo = info;
109
		this.existsWorkspace = existsInWorkspace;
110
		this.existsWorkspace = existsInWorkspace;
110
	}
111
	}
112
	
113
	/**
114
	 * Releases elements that won't be needed any more for garbage collection.
115
	 * Should be called before adding a node to the free list.
116
	 */
117
	public void releaseForGc() {
118
		this.child = null;
119
		this.resource = null;
120
		this.store = null;
121
		this.fileInfo = null;
122
	}
111
123
112
	public void setExistsWorkspace(boolean exists) {
124
	public void setExistsWorkspace(boolean exists) {
113
		this.existsWorkspace = exists;
125
		this.existsWorkspace = exists;
(-)src/org/eclipse/core/internal/localstore/UnifiedTree.java (-3 / +12 lines)
Lines 9-14 Link Here
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Martin Oberhuber (Wind River) - [105554] handle cyclic symbolic links
10
 *     Martin Oberhuber (Wind River) - [105554] handle cyclic symbolic links
11
 *     Martin Oberhuber (Wind River) - [232426] shared prefix histories for symlinks
11
 *     Martin Oberhuber (Wind River) - [232426] shared prefix histories for symlinks
12
 *     Martin Oberhuber (Wind River) - [292267] OutOfMemoryError due to leak in UnifiedTree
12
 *******************************************************************************/
13
 *******************************************************************************/
13
package org.eclipse.core.internal.localstore;
14
package org.eclipse.core.internal.localstore;
14
15
Lines 107-114 Link Here
107
				addNodeChildrenToQueue(node);
108
				addNodeChildrenToQueue(node);
108
			else
109
			else
109
				removeNodeChildrenFromQueue(node);
110
				removeNodeChildrenFromQueue(node);
110
			//allow reuse of the node
111
			//allow reuse of the node, but don't let the freeNodes list grow infinitely
111
			freeNodes.add(node);
112
			if (freeNodes.size() < 32767) {
113
				//free memory-consuming elements of the node for garbage collection
114
				node.releaseForGc();
115
				freeNodes.add(node);
116
			}
117
			//else, the whole node will be garbage collected since there is no
118
			//reference to it any more.
112
		}
119
		}
113
	}
120
	}
114
121
Lines 171-177 Link Here
171
				} else if (comp > 0) {
178
				} else if (comp > 0) {
172
					// resource exists only in file system
179
					// resource exists only in file system
173
					//don't create a node for symbolic links that create a cycle
180
					//don't create a node for symbolic links that create a cycle
174
					if (!localInfo.getAttribute(EFS.ATTRIBUTE_SYMLINK) || !localInfo.isDirectory() || !isRecursiveLink(node.getStore(), localInfo))
181
					if (localInfo.getAttribute(EFS.ATTRIBUTE_SYMLINK) && localInfo.isDirectory() && isRecursiveLink(node.getStore(), localInfo))
182
						child = null;
183
					else
175
						child = createChildNodeFromFileSystem(node, localInfo);
184
						child = createChildNodeFromFileSystem(node, localInfo);
176
					localIndex++;
185
					localIndex++;
177
				} else {
186
				} else {

Return to bug 292267