Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite861d98

Browse files
authored
fix memory capture by TcSymbolUses (dotnet#2377)
This fixes memory capture by the retained TcSymbolUses structure, which was unnecessarily capturing the NameResolutionEnv objects for each symbol use
1 parent3bf3960 commite861d98

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

‎src/fsharp/NameResolution.fs‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,15 +1391,20 @@ type TcResolutions
13911391

13921392
/// Represents container for all name resolutions that were met so far when typechecking some particular file
13931393
typeTcSymbolUses(g, capturedNameResolutions:ResizeArray<CapturedNameResolution>,formatSpecifierLocations: range[])=
1394+
1395+
// Make sure we only capture the information we really need to report symbol uses
1396+
letcnrs=[|for cnrin capturedNameResolutions-> cnr.Item, cnr.ItemOccurence, cnr.DisplayEnv, cnr.Range|]
1397+
letcapturedNameResolutions=()
1398+
do ignore capturedNameResolutions// don't capture this!
13941399

13951400
memberthis.GetUsesOfSymbol(item)=
1396-
[|forcnrincapturedNameResolutionsdo
1397-
if protectAssemblyExplorationfalse(fun()-> ItemsAreEffectivelyEqual g itemcnr.Item)then
1398-
yieldcnr.ItemOccurence, cnr.DisplayEnv, cnr.Range|]
1401+
[|for(cnrItem,occ,denv,m)incnrsdo
1402+
if protectAssemblyExplorationfalse(fun()-> ItemsAreEffectivelyEqual g itemcnrItem)then
1403+
yieldocc, denv, m|]
13991404

14001405
memberthis.GetAllUsesOfSymbols()=
1401-
[|forcnrincapturedNameResolutionsdo
1402-
yield(cnr.Item, cnr.ItemOccurence, cnr.DisplayEnv, cnr.Range)|]
1406+
[|for(cnrItem,occ,denv,m)incnrsdo
1407+
yield(cnrItem, occ, denv, m)|]
14031408

14041409
memberthis.GetFormatSpecifierLocations()= formatSpecifierLocations
14051410

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp