lua-users home
lua-l archive

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


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Javier Guerra wrote:
[...]
> doing it similarly he's seeing 2.6GB... doesn't seem right.
> 
> what might be the difference between yours and his test?

What I've got is this:

function go()
        run = {}
        for i=1, 1000000 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 = {}

        for a in io.open("/proc/self/maps"):lines() do print(a) end
end

(That last line is a fun hack that dumps data on all the memory segments
 used by the current process. Linux only, most likely.)

If I run this with:

  go() go()

...I see the heap segment at 800MB and then 1.5GB (so it doubles).
(Which indeed shows that the allocations are too small to trigger mmap()
allocation.) If I run it with:

  go() collectgarbage("collect")
  go() collectgarbage("collect")

...I see it remain static at 800MB.

This is Lua 5.1.2 on Ubuntu Gutsy.

- --
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│ "Wizards get cranky, / Dark days dawn, / Riders smell manky, / The
│ road goes on. / Omens are lowering, / Elves go West; / The Shire needs
│ scouring, / You may as well quest." - John M. Ford
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHxY5Uf9E0noFvlzgRAmS4AKCSRbcAR9LIh3RjH1s/MogIt9zIaACfY30g
oD+zqsXl8ODbIlQwcxsqH98=
=6de5
-----END PGP SIGNATURE-----