Groups 127 of 99+ julia-users › Tasks and garbage collection 3 posts by 2 authors James Fairbanks 12/8/15 Task objects, which are created by @task f(args), hold on to some resources. How do those resources get released? For example, if I have a function that makes a task that doesn't return, what happens? function doforever() while true produce(true) end end function g(n::Int) t = @task doforever() for i in 1:n return consume(t) end end for i in 1:10000 g(5) end How many tasks are still in existence at the end of this loop? Do the resources associated with a task get released as soon as all references to the Task instance go out of scope? Does the task need to be "done" before releasing the resources? I expect the answers to be 1 (the main task), yes (at first available gc cycle), no. The docs page http://docs.julialang.org/en/release-0.4/stdlib/parallel/ doesn't really cover these issues so I am not sure. Also is there a reference that details what resources Task instances possess? James Fairbanks 12/8/15 I noticed a typo in my original post function g should have been: function g(n::Int) t = @task doforever() for i in 1:n println(consume(t)) end end - show quoted text - Seth 12/8/15 I just did an experiment with: function doforever() while true produce(zeros(100000,10000)) # ~8 gigabytes end end and the memory deallocated when I did an explicit gc(). - show quoted text -