lua-users home
lua-l archive

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


> Does Lua ever realloc() or malloc() 0 bytes?

Frequently.


> What are the expected semantics of:
> 
> 1. realloc() an existing block to a size of 0 bytes?

Free the block. (Assuming 'realloc' is Lua allocation function.)


> When nsize is zero, the allocator must return NULL; if osize is not
> zero, it should free the block pointed to by ptr.


> 2. realloc() a new block to a size of 0 bytes?

no op (unlike C realloc).

-- Roberto