[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: When are coroutines collected?
- From: Chris <coderight@...>
- Date: Wed, 27 Feb 2008 10:17:28 -0500
Consider the following:
run = {}
for i=1, 100000 do table.insert(run, coroutine.create(function() end)) end
print(coroutine.status(run[1]))
for k,v in ipairs(run) do coroutine.resume(v) end
print(coroutine.status(run[1]))
run = {}
collectgarbage("collect")
At the end all the coroutines are "dead" yet they are still taking up
memory. It looks like they have not been collected. Is there some
sort of weird table interaction here or something else that must be
done to get rid of them from memory? As it stands now my application
just continues to increase its memory usage over time as coroutines
are created and destroyed. Eventually it eats all the memory on the
machine.
CR