[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Does malloc() have to zero the block?
- From: roberto@... (Roberto Ierusalimschy)
- Date: Wed, 19 Sep 2007 17:21:12 -0300
> 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