F # Interactive memory leak

If I open fsi and paste the following:

[1..10000000];;
[1..10000000];;
[1..10000000];;
[1..10000000];;
[1..10000000];;
[1..10000000];;
[1..10000000];;
[1..10000000];;
[1..10000000];;

      

I get:

System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.

      

The same if I prefix let x =

. It seems that links to the highest level continue to be held, however inaccessible they are. Is there a way to clean up these things without losing the convenience of data flow? Right now I'm just rebooting to clean up, but that's awkward.

+3


source to share


2 answers


Since you're ready to use let x = [1..10000000]

, use:

let mutable x = [1..10000000];; 

      

and data memory reuse:



x <- [1..10000000];;  

      

and free up data memory usage:

x <- [];; 

      

+2


source


I don't think there is a way to clear the top level links in FSI. You can increase the amount of memory that FSI can use by using 64-bit mode for F # Interactive. In VisualStudio it is "Tools-Options-F # Tools-> F # Interactive" settings



+2


source







All Articles