lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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