Skip to content

Instantly share code, notes, and snippets.

@t0yv0
Created December 29, 2011 20:06
Show Gist options
  • Save t0yv0/1535973 to your computer and use it in GitHub Desktop.
Save t0yv0/1535973 to your computer and use it in GitHub Desktop.
let leak1 () =
let thread () =
async {
let x = Array.create 1024 0uy
return ()
}
|> Async.Start
async {
while true do
do thread ()
}
|> Async.RunSynchronously
let leak2 () =
let a1 () = async.Return()
let a2 () =
async {
let! complete = Async.StartChild(a1 ())
return! complete
}
|> Async.Start
let rec loop (k: int) =
if k > 0 then
do a2 ()
loop (k - 1)
loop 100000
stdout.Write("PRESS ANY KEY") // >200 Mb memory use, retained
System.Console.ReadLine()
|> ignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment