aboutsummaryrefslogtreecommitdiff
path: root/lmem.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-12-20 17:40:07 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-12-20 17:40:07 -0200
commit551b076f1c7f9b66eecd8f6b7a12b1bd7a78b967 (patch)
treebde2f0e23706683829e87d4e239793de373444e7 /lmem.c
parent737f119187aca3c8f6743ec6e3cfc04e83723180 (diff)
downloadlua-551b076f1c7f9b66eecd8f6b7a12b1bd7a78b967.tar.gz
lua-551b076f1c7f9b66eecd8f6b7a12b1bd7a78b967.tar.bz2
lua-551b076f1c7f9b66eecd8f6b7a12b1bd7a78b967.zip
change in the relationship between totalbytes and GCdebt - luaM_realloc_
is too critical to update two counters
Diffstat (limited to 'lmem.c')
-rw-r--r--lmem.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lmem.c b/lmem.c
index 31c03364..090caa9a 100644
--- a/lmem.c
+++ b/lmem.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lmem.c,v 1.79 2010/05/05 18:49:56 roberto Exp roberto $ 2** $Id: lmem.c,v 1.80 2010/12/20 18:17:46 roberto Exp roberto $
3** Interface to Memory Manager 3** Interface to Memory Manager
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -94,8 +94,7 @@ void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) {
94 luaD_throw(L, LUA_ERRMEM); 94 luaD_throw(L, LUA_ERRMEM);
95 } 95 }
96 lua_assert((nsize == 0) == (newblock == NULL)); 96 lua_assert((nsize == 0) == (newblock == NULL));
97 g->totalbytes = (g->totalbytes - realosize) + nsize; 97 g->GCdebt = (g->GCdebt + nsize) - realosize;
98 g->GCdebt += nsize; /* give some credit to garbage collector */
99#if defined(TRACEMEM) 98#if defined(TRACEMEM)
100 { /* auxiliary patch to monitor garbage collection. 99 { /* auxiliary patch to monitor garbage collection.
101 ** To plot, gnuplot with following command: 100 ** To plot, gnuplot with following command: