Bug 236628 [Viewers] [JFace] Excessive Memory Usage by Project Explorer because of styles
Build ID: I20080516-1333 Steps To Reproduce: Project Explorer creates duplicate identical strings for every entry in it and wastes few Megabytes of memory depending on the scenario. In the update method of NavigatorDecoratingLabelProvider extending DelegatingStyledCellLabelProvider the call to cell.setStyleRanges(newStyleRanges) results in duplicate strings for the same column. The duplicate strings are created in ViewerRow.setStyleRanges public void setStyleRanges(int columnIndex, StyleRange[] styleRanges) { getItem().setData(KEY_TEXT_LAYOUT + columnIndex, styleRanges); } More information:
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerRow.java
/**
	 * Set the style ranges to be applied on the text label at the column index
	 * Note: Requires {@link StyledCellLabelProvider} with owner draw enabled.
	 * 
	 * @param columnIndex
	 *            the index of the column
	 * @param styleRanges
	 *            the styled ranges
	 * 
	 * @since 3.4
	 */
	public void setStyleRanges(int columnIndex, StyleRange[] styleRanges) {
		getItem().setData(KEY_TEXT_LAYOUT + columnIndex, styleRanges);
	}
	/**
	 * Returns the style ranges to be applied on the text label at the column
	 * index or <code>null</code> if no style ranges have been set.
	 * 
	 * @param columnIndex
	 *            the index of the column
	 * @return styleRanges the styled ranges
	 * 
	 * @since 3.4
	 */
	public StyleRange[] getStyleRanges(int columnIndex) {
		return (StyleRange[]) getItem().getData(KEY_TEXT_LAYOUT + columnIndex);
	}
	int getWidth(int columnIndex) {
		return getBounds(columnIndex).width;
	}