Community
Participate
Working Groups
With bug 205257, strings of certain parts of project model were intern()-ed to improve memory footprint. In particular, OptionStringValue, PathInfo data. As those correspond to ICLanguageSettingsEntrys in ever "new" project model, and very much contain the same strings already - it makes sense to do the same for ACSettingEntry and CMacroEntry. I am testing that with new scanner discovery in Memory Analyser and getting 5x savings for retained heap for Firefox project.
Committed on master.
Be careful with the measurements. Strings created with String.intern() are stored in the PermSpace which does not count towards the heap space.
Agreed. This is going to quickly exhaust PermGen on Sun VMs, and will lead to confusing out of memory errors for users. A better bet would be to implement the StringPool pattern used in the platform. That way you get de-duplication, but the large memory footprint associated with the LSE strings is still contained in the normal Heap.
My point here is that those same string values are *already* being interned in OptionStringValue, PathInfo and PerFileSICollector. If anything, this change avoids creating another copy on the heap. BTW, do you guys know any good tool to analyze PermGen space? (In reply to comment #3) > A better bet would be to implement the StringPool pattern used in the platform. > That way you get de-duplication, but the large memory footprint associated with > the LSE strings is still contained in the normal Heap. Thanks for the pointer, I'll take a look. Is it for strings only and do you know any pool pattern which can work with weak references?
Markus, there is org.eclipse.cdt.internal.core.parser.util.WeakHashSet<T> class. It looks like the one I am looking for. Is there any ominous reason why you stopped using it, and why it is still there even if it doesn't appear to be used anywhere?