[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Lua presentation at XGDC3.0
- From: Roberto Ierusalimschy <rieru@...>
- Date: Wed, 19 Sep 2001 12:21:59 -0500 (CDT)
On Wed, 19 Sep 2001, Mathew Hendry wrote:
> No, but it seems to do all its memory management through the functions in
> src/lmem.c, so it should be easy to patch. (I hope so, because I'm going to
> have to do this as well :)
All memory requests in the Lua core are done through a single function,
luaM_realloc. Its specification is quite similar to realloc, but (1) it
raises an error in case of errors (instead of returning NULL), (2) a
request "realloc(x, 0)" returns NULL, even when x is NULL, (3) it keeps
track of the total number of bytes allocated (it always gets an extra
argument, which is the original size of the block).
> Looks like src/lib/liolib.c will need patching too.
The libraries do not use luaM_realloc, because it is not exported. But in
Lua 4.1 alpha no library does direct memory requests. (We will try to
keep them that way.)
-- Roberto