[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: initialization of userdata
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Fri, 16 Dec 2011 15:27:23 -0200
> 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...