[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LUA + musl, garbage collection issue?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Sun, 21 Sep 2014 03:39:10 -0300
> I noticed that in order to free memory, it basically calls realloc with 0 as the new size. Is this something musl doesn't handle well?
Lua does not do that. It does call its own allocator function with
size==0, but its own allocator function is not 'realloc'. In standard
Lua, the allocator function looks like this:
static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
(void)ud; (void)osize; /* not used */
if (nsize == 0) {
free(ptr);
return NULL;
}
else
return realloc(ptr, nsize);
}
So, if size==0, it calls 'free', not 'realloc'.
-- Roberto