Skip to content

Commit 25a8ddc

Browse files
committed
[Session] Fix every source file having a copy of every method instance.
This decreases memory usage by having only methods in a source file being used inside. Based on my analysis of mdb writers, the mapping is one CompilationUnit for each SourceFileEntry. See MdbWriter and SymbolWriterImpl and grep for DefineDocument. Bug 45792 - Exponential memory usage when loading mdb files
1 parent ac17c08 commit 25a8ddc

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Mono.Debugging.Soft/SoftDebuggerSession.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2606,16 +2606,19 @@ bool LoadMdbFile(string mdbFileName)
26062606

26072607
using(MonoSymbolFile mdb = MonoSymbolFile.ReadSymbolFile(mdbFileName))
26082608
{
2609-
foreach (var src in mdb.Sources)
2609+
foreach (var cu in mdb.CompileUnits)
26102610
{
26112611
MdbSourceFileInfo info = new MdbSourceFileInfo ();
26122612

2613+
var src = cu.SourceFile;
26132614
info.Hash = src.Checksum;
26142615
info.FileID = src.Index;
26152616
info.FullFilePath = src.FileName;
26162617

2617-
foreach (var method in mdb.Methods)
2618-
info.Methods.Add (new MethodMdbInfo{ SequencePoints = method.GetLineNumberTable ().LineNumbers });
2618+
foreach (var method in mdb.Methods) {
2619+
if (method.CompileUnitIndex == cu.Index)
2620+
info.Methods.Add (new MethodMdbInfo { SequencePoints = method.GetLineNumberTable ().LineNumbers });
2621+
}
26192622

26202623
fileToSourceFileInfos [src.FileName] = new List<MdbSourceFileInfo> ();
26212624

0 commit comments

Comments
 (0)