lua-users home
lua-l archive

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


On Tue, Apr 7, 2009 at 12:45 AM, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
>> > As for strings, they're stored in a global table, accessible in one of lua
>> > state's fields, called "strt" IIRC; you can easily write a C function to
>> > traverse it.
>> >
>>
>> I would be extremely happy to see at least a function to get the
>> actual size in *bytes* of a given object in 5.2. Perhaps in the debug
>> library.
>>
>> Is such a function possible?
>
> See http://lua-users.org/lists/lua-l/2009-04/msg00030.html but that does not
> traverse the string table.
>

This is one half of the solution, but from what I understand, it
doesn't actually tell you how much memory each object is allocated. So
what we need is this script + some debug.getsize() function. Or would
it be possible to accurately gauge allocated space in a pure-Lua
implementation?