lua-users home
lua-l archive

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


> The manual says of `luanewuserdata`:
> ???allocates a new block of memory with the given size, pushes onto the
> stack a new full userdata with the block address, and returns this
> address.
> 
> It does not say the block is initialized to zero, but that invariably
> has so far been true on my system.
> 
> Implementation detail?

Lua uses whatever memory allocator is given in lua_newstate. If you use
luaL_newstate then realloc is used and realloc is not required to initialize
blocks to zero. So you're probably seeing a libc implementation detail...