lua-users home
lua-l archive

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


Am 28.05.2015 um 22:01 schröbte Brigham Toskin:
Hey all.

Hi!


[...]

Obviously os.clock has limitations–which I'm okay with, since I don't need
exact profiling data–but how accurate is collectgarbage("count")? The
manual says it returns usage in "K bytes", so to get the answer in megs I
divide by 1024; is this a reasonable adjustment for what it's actually
returning? Does Lua actually respect the "stop" subcommand? Is the perhaps
an issue more of the allocator than the garbage collector? I could be
leaking memory, but 40 MB seems excessive.

I get about 140 MB in the "Hash-linked" `foreach_sum8` test on a 64-bit machine.


Thoughts? Am I approaching my measurements completely wrong?


For one, you are not measuring what you think you are measuring: The 140 MB is the memory used by 800000 closures with 3 unique upvalues each, created by the `lvalues()` function. (That's why the `foreach_sum8` test takes two times more memory than the `foreach_sum4` test, and 8 times more memory than the `foreach_sum1` tests.) The list elements are just noise in comparison ...

Philipp