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. [...]

I failed to see this behavior. Adding print(collectgarbage("count")) at
the beginning and at the end of that script, my machine (running Lua
5.1.1) gives the following output:

  19.3125
  suspended
  dead
  18.1572265625


-- Roberto