From 551b076f1c7f9b66eecd8f6b7a12b1bd7a78b967 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 20 Dec 2010 17:40:07 -0200 Subject: change in the relationship between totalbytes and GCdebt - luaM_realloc_ is too critical to update two counters --- lmem.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lmem.c') diff --git a/lmem.c b/lmem.c index 31c03364..090caa9a 100644 --- a/lmem.c +++ b/lmem.c @@ -1,5 +1,5 @@ /* -** $Id: lmem.c,v 1.79 2010/05/05 18:49:56 roberto Exp roberto $ +** $Id: lmem.c,v 1.80 2010/12/20 18:17:46 roberto Exp roberto $ ** Interface to Memory Manager ** See Copyright Notice in lua.h */ @@ -94,8 +94,7 @@ void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) { luaD_throw(L, LUA_ERRMEM); } lua_assert((nsize == 0) == (newblock == NULL)); - g->totalbytes = (g->totalbytes - realosize) + nsize; - g->GCdebt += nsize; /* give some credit to garbage collector */ + g->GCdebt = (g->GCdebt + nsize) - realosize; #if defined(TRACEMEM) { /* auxiliary patch to monitor garbage collection. ** To plot, gnuplot with following command: -- cgit v1.2.3-55-g6feb