[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.4.2 (realloc ?)
- From: Francisco Olarte <folarte@...>
- Date: Mon, 9 Nov 2020 18:23:07 +0100
Rainier:
On Mon, Nov 9, 2020 at 6:07 PM Ranier Vilela <ranier.vf@gmail.com> wrote:
> Em seg., 9 de nov. de 2020 às 13:54, Francisco Olarte <folarte@peoplecall.com> escreveu:
...
>> you try malloc or any other function and do not program it right. This
>> is C memory management 101.
>
> Like this:
> l_alloc function (lauxlib.c)
> 995: return realloc(ptr, nsize);
Did you bother reading the docs? Specifically the phrase "When nsize
is not zero, the allocator must behave like realloc. " ( btw, that
usage is, IIRC, protected inside the else branch of a nice "if
(nsize==0)".
If you want to look for ptr leaks you have to search for the usages of
the l_alloc function passed and stored inside the state. I believe
they are confined inside lmem.* but i'm not sure of that one.
Francisco Olarte.