[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: memory management: lua_Alloc and handling exceptions
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Sat, 16 May 2020 10:43:35 -0300
> The new allocator in specific circumstances decides to deny its operations, allocations and free
> (also free because it checks for possible corruptions of the memory pointers).
lua_Alloc should behave externally like realloc. In particular, the
allocator should return NULL when it cannot fulfill an allocation
request.
On the other hand, the manual says: "When nsize is zero, the allocator
must behave like free and return NULL.". So you cannot signal errors
in free by returning NULL. I think you cannot signal erros in free at
all. The allocator cannot set L->status because it does not receive L.
Moreover, the code in lmem.c never checks L->status.
_______________________________________________
lua-l mailing list -- lua-l@lists.lua.org
To unsubscribe send an email to lua-l-leave@lists.lua.org