lua-users home
lua-l archive

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


On 19 December 2014 at 13:51, <andre@leiradella.com> wrote:
The manual says that "ptr is NULL if and only if osize is zero." Besides, my implementation closely follows the sample implementation in the user manual: http://www.lua.org/manual/5.1/manual.html#lua_Alloc

I tried to write an allocator that respects all the rules in the user manual, one by one:

Are you using 5.1?
Could you show me some sample output?

Try reading from the 5.2 manual, it is much clearer: http://www.lua.org/manual/5.2/manual.html#lua_Alloc
The osize as indication of type of new in 5.2; you need to check `ptr` before looking at `osize`.