-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
I believe using immutable dictionary inside ProjectInstance is a new change. But those dictionaries doesn't share the same comparer. It leads 850k of exactly same comparer objects loaded in the memory after loading Roslyn.sln.
It should be straight to fix: please create a shared empty collection (after calling WithComparer) to be the base collection to start with instead of calling WithComparer on every instance. + @ladipro & @panopticoncentral : i think this is related to recent changes in this area.
| Name | Exc % | Exc | Exc Ct | Inc % | Inc | Inc Ct |
|---|---|---|---|---|---|---|
| || + System.Collections.Immutable!Immutable.ImmutableDictionary+Comparers | 0.2 | 853,936 | 53,371 | 0.2 | 853,936 | 53,371 |
Here are some samples:
0:000> !do 0x20a36144
Name: System.Collections.Immutable.ImmutableDictionary`2+Comparers[[System.String, mscorlib],[Microsoft.Build.Execution.ProjectMetadataInstance, Microsoft.Build]]
MethodTable: 261858d4
EEClass: 797915d4
Size: 16(0x10) bytes
File: C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\Common7\IDE\PrivateAssemblies\System.Collections.Immutable.dll
Fields:
MT Field Offset Type VT Attr Value Name
733890fc 400008a 4 ...Canon, mscorlib]] 0 instance 20aceb0c _keyComparer
733890fc 400008b 8 ...Canon, mscorlib]] 0 instance 2b6bf014 _valueComparer
7976a7f4 4000089 0 ...Canon, mscorlib]] 0 shared static Default
>> Domain:Value dynamic statics NYI 01467068:NotInit <<
0:000> !do 0x20a4395c
Name: System.Collections.Immutable.ImmutableDictionary`2+Comparers[[System.String, mscorlib],[Microsoft.Build.Execution.ProjectMetadataInstance, Microsoft.Build]]
MethodTable: 261858d4
EEClass: 797915d4
Size: 16(0x10) bytes
File: C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\Common7\IDE\PrivateAssemblies\System.Collections.Immutable.dll
Fields:
MT Field Offset Type VT Attr Value Name
733890fc 400008a 4 ...Canon, mscorlib]] 0 instance 20aceb0c _keyComparer
733890fc 400008b 8 ...Canon, mscorlib]] 0 instance 2b6bf014 _valueComparer
7976a7f4 4000089 0 ...Canon, mscorlib]] 0 shared static Default
>> Domain:Value dynamic statics NYI 01467068:NotInit <<
0:000> !do 0x20a43a8c
Name: System.Collections.Immutable.ImmutableDictionary`2+Comparers[[System.String, mscorlib],[Microsoft.Build.Execution.ProjectMetadataInstance, Microsoft.Build]]
MethodTable: 261858d4
EEClass: 797915d4
Size: 16(0x10) bytes
File: C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\Common7\IDE\PrivateAssemblies\System.Collections.Immutable.dll
Fields:
MT Field Offset Type VT Attr Value Name
733890fc 400008a 4 ...Canon, mscorlib]] 0 instance 20aceb0c _keyComparer
733890fc 400008b 8 ...Canon, mscorlib]] 0 instance 2b6bf014 _valueComparer
7976a7f4 4000089 0 ...Canon, mscorlib]] 0 shared static Default
>> Domain:Value dynamic statics NYI 01467068:NotInit <<
Reactions are currently unavailable