Skip to content

Commit e9c2f83

Browse files
committed
add docs and 64-bit limit
1 parent 3e43abf commit e9c2f83

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

RELEASE_NOTES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
#### 1.4.0.8 -
2+
* FSharpType.Format now prettifies type variables. If necessary, FSharpType.Prettify can also be called
3+
* Add maximum-memory trigger to downsize FCS caches. Defaults to 1.7GB of allocaed memory in the system
4+
process for a 32-bit process, and 2x this for a 64-bit process
5+
16
#### 1.4.0.7 -
27
* fix 427 - Make event information available for properties which represent first-class uses of F#-declared events
38
* fix 410 - Symbols for C# fields (and especially enum fields)

docs/content/caches.fsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Compiler Services: Notes on the FSharpChecker caches
66
77
This is a design note on the FSharpChecker component and its caches. See also the notes on the [FSharpChecker operations queue](queue.html)
88
9-
FSharpChecker maintains a set of caches. These are
9+
Each FSharpChecker object maintains a set of caches. These are
1010
1111
* ``scriptClosureCache`` - an MRU cache of default size ``projectCacheSize`` that caches the
1212
computation of GetProjectOptionsFromScript. This computation can be lengthy as it can involve processing the transative closure
@@ -55,6 +55,25 @@ The sizes of some of these caches can be adjusted by giving parameters to FSharp
5555
the cache sizes above indicate the "strong" size of the cache, where memory is held regardless of the memory
5656
pressure on the system. Some of the caches can also hold "weak" references which can be collected at will by the GC.
5757
58+
> Note: Because of these caches, uou should generally use one global, shared FSharpChecker for everything in an IDE application.
59+
60+
61+
Low-Memory Condition
62+
-------
63+
64+
Version 1.4.0.8 added a "maximum memory" limit specified by the `MaxMemory` property on FSharpChecker (in MB). If an FCS project operation
65+
is performed (see `CheckMaxMemoryReached` in `service.fs`) and `System.GC.GetTotalMemory(false)` reports a figure greater than this, then
66+
the strong sizes of all FCS caches are reduced to either 0 or 1. This happens for the remainder of the lifetime of the FSharpChecker object.
67+
In practice this will still make tools like the Visual Studio F# Power Tools usable, but some operations like renaming across multiple
68+
projects may take substantially longer.
69+
70+
For a 32-bit process the default threshold is 1.7GB of allocated managed memory in a process, see `maxMBDefault` in `service.fs`. For a 64-bit process
71+
it is twice this.
72+
73+
Reducing the FCS strong cache sizes does not guarantee there will be enough memory to continue operations - even holding one project
74+
strongly may exceed a process memory budget. It just means FCS may hold less memory strongly.
75+
76+
If you do not want the maximum memory limit to apply then set MaxMemory to System.Int32.MaxValue.
5877
5978
Summary
6079
-------

src/fsharp/vs/service.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ module EnvMisc =
6262

6363
let projectCacheSizeDefault = GetEnvInteger "mFSharp_ProjectCacheSizeDefault" 3
6464
let frameworkTcImportsCacheStrongSize = GetEnvInteger "mFSharp_frameworkTcImportsCacheStrongSizeDefault" 8
65-
let maxMBDefault = GetEnvInteger "mFSharp_maxMB" 1700
65+
let maxMBDefault = GetEnvInteger "mFSharp_maxMB" (if sizeof<int> = 4 then 1700 else 3400)
6666

6767
//----------------------------------------------------------------------------
6868
// Methods

0 commit comments

Comments
 (0)