[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Memory Allocation Hooks
- From: William Ahern <william@...>
- Date: Tue, 11 Jan 2005 21:29:27 -0800
On Wed, Jan 12, 2005 at 12:15:37AM -0500, Jay Carlson wrote:
> >However, lua 5.1 (still work in progress) does this with
> >a runtime hook:
> >
> >void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t
> >nsize) {
> > global_State *g = G(L);
> > lua_assert((osize == 0) == (block == NULL));
> > block = (*g->realloc)(g->ud, block, osize, nsize);
> >----------*************
> >
> >
> >[BTW: those codes are spagetti .. :]
>
> *g->realloc is win32's fault. You now know where to send your mailbombs.
hahahahah
Actually, the arena library I've written requires the old size as well, so
it maps perfectly. Of course, I don't even try freeing anything but the last
block except when destroying the arena. Going by my experience using
Windows, I suspect Win32 might do the same ;)
Thanks.