lua-users home
lua-l archive

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



On Sep 5, 2013, at 1:39 PM, Andres Perera <andres.p@zoho.com> wrote:

>
> Hmmm … i'd say the cost of ONE void* pointer in a Lua_State was pretty insubstantial, even if you spin up a LOT of them. it may even be free, since most heap managers round up allocated sizes to some power of 2 multiple, so the actual size of the allocated Lua_State may not change.

1. The minimal heap allocation is a multiple of page size in modern systems, not an arbitrary power of two.

No way! .. If I allocate 18 bytes using malloc() it does NOT involve allocating an entire 4K (or whatever) page.

2. The only relevant size constraint isn't heap bound. If you are eg. copying states, the possibly unused user pointer is going to touch a register.

Well good luck copying a Lua_State (can you spell crash?), and why would placing an extra field in a structure touch an extra register?

--Tim