lua-users home
lua-l archive

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


It was thus said that the Great Tom Sutcliffe once stated:
> The first figure on each line of the stats below is the memory used 
> according to the allocator, and the second the figure returned from lua_gc. 
> The allocator is one which doesn't have any allocation overhead (except for 
> 8-byte alignment padding), and in this runtime there are no allocations 
> that aren't via Lua, so the two figures should in theory match pretty 
> closely. lua_gc seems to underestimate quite heavily, however. I assume 
> that either it is not counting some of its own state in the figures it 
> returns, or maybe the underestimation is simply the sum of all the strings 
> whose lengths aren't a multiple of 8 (and thus Lua thinks they're smaller 
> than the allocator does).

  One question---does your allocator just assign the next available free
spot?  And is free() implemented?  To me, the difference can be explained by
Lua freeing some garbage that isn't reflected in your custom allocator.

  -spc