Skip to content

Instantly share code, notes, and snippets.



Created Jan 20, 2011
What would you like to do?
iterator block gotcha sample code - F# equivalent
// Learn more about F# at
open System
let showMemory( msg : string) =
let memory = GC.GetTotalMemory(true)
Console.WriteLine("{0, -30} {1}", msg + ":", memory)
let main ()=
let source = seq {0 .. 1000000}
let query = Seq.distinct source
showMemory("Before Count()")
Seq.length query |> ignore
showMemory("After Count()")
showMemory("After query eligible for GC")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment