lua-users home
lua-l archive

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


On Mon, Nov 9, 2020 at 6:07 PM Ranier Vilela <> wrote:
> Em seg., 9 de nov. de 2020 às 13:54, Francisco Olarte <> 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

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.