You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All the Attributes parsed in DwarfSymbolProvider.DwarfCompilationUnit.ReadData are not deduplicated/interned.
For a big binary (in my case with debug info about 900MB) this will cause extreme memory usage.
Within the first 100 compilation units my memory usage rises to 12GB and then it gets stuck there because I ran out of memory.
As a ultra ugly hotfix I added this in DwarfSymbolProvider.ParseCompilationUnits
privatestaticDwarfCompilationUnit[]ParseCompilationUnits(byte[]debugData,byte[]debugDataDescription,byte[]debugStrings,NormalizeAddressDelegateaddressNormalizer){using(DwarfMemoryReaderdebugDataReader=newDwarfMemoryReader(debugData))using(DwarfMemoryReaderdebugDataDescriptionReader=newDwarfMemoryReader(debugDataDescription))using(DwarfMemoryReaderdebugStringsReader=newDwarfMemoryReader(debugStrings)){List<DwarfCompilationUnit>compilationUnits=newList<DwarfCompilationUnit>();StringInternerinterner=newStringInterner();List<Task>tasksList=newList<Task>();while(!debugDataReader.IsEnd){DwarfCompilationUnitcompilationUnit=newDwarfCompilationUnit(debugDataReader,debugDataDescriptionReader,debugStringsReader,addressNormalizer,interner);tasksList.Add(Task.Run(()=>{// intern all attributes in seperate threadsforeach(varcompilationUnitSymbolincompilationUnit.Symbols){compilationUnitSymbol.Attributes=compilationUnitSymbol.Attributes.Select(x =>newKeyValuePair<DwarfAttribute,DwarfAttributeValue>(x.Key,interner.InternObject(x.Value)asDwarfAttributeValue)).ToDictionary(x =>x.Key, x =>x.Value);}}));compilationUnits.Add(compilationUnit);}Task.WaitAll(tasksList.ToArray());returncompilationUnits.ToArray();}}
This keeps my memory usage at the 400th compilation unit down at 7.7GB which is atleast usable.
I originally did the interning in DwarfCompilationUnit.data but that took too much time, the data reading is already the performance bottleneck, better not add anything extra to it.
Moving it out into a seperate thread/task works well for me so far.
One could probably intern the whole attribute instead of just the attribute value, not sure if that would be better, I assume it won't.
The text was updated successfully, but these errors were encountered:
The next way more elaborate step would be noticing that almost all CU's have the std:: namespace, with over and over again the same symbols inside it that can all be deduplicated (the only things that are different are the offsets), but oof
All the Attributes parsed in DwarfSymbolProvider.DwarfCompilationUnit.ReadData are not deduplicated/interned.
For a big binary (in my case with debug info about 900MB) this will cause extreme memory usage.
Within the first 100 compilation units my memory usage rises to 12GB and then it gets stuck there because I ran out of memory.
As a ultra ugly hotfix I added this in DwarfSymbolProvider.ParseCompilationUnits
This keeps my memory usage at the 400th compilation unit down at 7.7GB which is atleast usable.
I originally did the interning in DwarfCompilationUnit.data but that took too much time, the data reading is already the performance bottleneck, better not add anything extra to it.
Moving it out into a seperate thread/task works well for me so far.
One could probably intern the whole attribute instead of just the attribute value, not sure if that would be better, I assume it won't.
The text was updated successfully, but these errors were encountered: