lua-users home
lua-l archive

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



Thursday, February 5, 2015, 6:01:04 PM, you wrote:

> Am 05.02.2015 um 21:36 schröbte mchalkley@mail.com:
>> Hello,

> Hi!

>>
>> I'm trying to debug some memory usage issues in a Lua script that I'm
>> working on.
>>
>> What's the best way to get the total amount of memory a table is using?

> There is a module lua-getsize that adds a `debug.getsize` function which
> does what you want. Original is here[1], a modified version that fixes
> some issues and adds compatibility with Lua 5.2 and 5.3 is here[2]. 
> lua-getsize uses PUC-Rio Lua internals, so it doesn't work with LuaJIT.
> You can combine lua-getsize with the microscope[3] module to get 
> GraphViz images like this[4] (sizes in bytes are in square brackets).


>>
>> Thanks,
>>
>> Mark
>>

> Philipp


>    [1]: http://code.matthewwild.co.uk/lua-getsize/
>    [2]: https://github.com/siffiejoe/lua-getsize/
>    [3]: https://github.com/siffiejoe/lua-microscope/
>    [4]: http://siffiejoe.github.io/lua-microscope/example1.gif

Awesome - thanks very much for the assistance!

Mark