Skip to content

Commit

Permalink
Adds more garbage collection settings
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAngryByrd committed Jul 22, 2023
1 parent 13038fd commit fb44d31
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
25 changes: 23 additions & 2 deletions release/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,8 @@
"FSharp.fsac.conserveMemory": {
"default": false,
"description": "Configures FsAutoComplete with settings intended to reduce memory consumption. Requires restart.",
"type": "boolean"
"type": "boolean",
"deprecationMessage": "This setting is deprecated. Use FSharp.fsac.gc.conserveMemory instead."
},
"FSharp.fsac.dotnetArgs": {
"default": [],
Expand All @@ -542,6 +543,26 @@
},
"type": "array"
},
"FSharp.fsac.gc.conserveMemory" : {
"default": 1,
"markdownDescription": "Configures the garbage collector to [conserve memory](https://learn.microsoft.com/en-us/dotnet/core/runtime-config/garbage-collector#conserve-memory) at the expense of more frequent garbage collections and possibly longer pause times. [Large Object Heap](https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/large-object-heap) will be compacted automatically if it has too much fragmentation. Requires restart.",
"type": "integer",
"minimum": 0,
"maximum": 9
},
"FSharp.fsac.gc.heapCount" : {
"default": 2,
"markdownDescription": "Limits the number of [heaps](https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/fundamentals#the-managed-heap) created by the garbage collector. Applies to server garbage collection only. See [Middle Ground between Server and Workstation GC](https://devblogs.microsoft.com/dotnet/middle-ground-between-server-and-workstation-gc/) for more details. This can allow FSAC to still benefit from Server garbage collection while still limiting the number of heaps. Requires restart.",
"type": "integer",
"required": [
"FSharp.fsac.gc.server"
]
},
"FSharp.fsac.gc.server": {
"default": true,
"markdownDescription": "Configures whether the application uses workstation garbage collection or server garbage collection. See [Workstation vs Server Garbage Collection](https://devblogs.microsoft.com/premier-developer/understanding-different-gc-modes-with-concurrency-visualizer/#workstation-gc-vs-server-gc) for more details. Workstation will use less memory but Server will have more throughput. Requires restart.",
"type": "boolean"
},
"FSharp.fsac.netCoreDllPath": {
"default": "",
"description": "The path to the \u0027fsautocomplete.dll\u0027, a directory containing TFM-specific versions of fsautocomplete.dll, or a directory containing fsautocomplete.dll. Useful for debugging a self-built FSAC. If a DLL is specified, uses it directly. If a directory is specified and it contains TFM-specific folders (net6.0, net7.0, etc) then that directory will be probed for the best TFM to use for the current runtime. This is useful when working with a local copy of FSAC, you can point directly to the bin/Debug or bin/Release folder and it\u0027ll Just Work. Finally, if a directory is specified and there are no TFM paths, then fsautocomplete.dll from that directory is used. Requires restart.",
Expand Down Expand Up @@ -1720,4 +1741,4 @@
"url": "https://github.com/ionide/ionide-vscode-fsharp.git"
},
"version": "7.8.2"
}
}
11 changes: 8 additions & 3 deletions src/Core/LanguageService.fs
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,11 @@ Consider:
let enableProjectGraph =
"FSharp.enableMSBuildProjectGraph" |> Configuration.get false

let conserveMemory = "FSharp.fsac.conserveMemory" |> Configuration.get false
let gcConserveMemory = "FSharp.fsac.gc.conserveMemory" |> Configuration.get 1

let gcHeapCount = "FSharp.fsac.gc.heapCount" |> Configuration.get 2

let gcServer = "FSharp.fsac.gc.server" |> Configuration.get true

let parallelReferenceResolution =
"FSharp.fsac.parallelReferenceResolution" |> Configuration.get false
Expand Down Expand Up @@ -788,8 +792,9 @@ Consider:

let fsacEnvVars =
[ yield! fsacEnvVars
if conserveMemory then
yield "DOTNET_GCConserveMemory", box "9"
yield "DOTNET_GCHeapCount", box (gcHeapCount.ToString("X")) // Requires hexadecimal value
yield "DOTNET_GCConserveMemory", box gcConserveMemory
yield "DOTNET_GCServer", box gcServer
if parallelReferenceResolution then
yield "FCS_ParallelReferenceResolution", box "true" ]

Expand Down

0 comments on commit fb44d31

Please sign in to comment.