diff options
-rw-r--r-- | lgc.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 2.54 2009/06/08 19:35:59 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.55 2009/07/16 16:26:09 roberto Exp roberto $ |
3 | ** Garbage Collector | 3 | ** Garbage Collector |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -735,12 +735,16 @@ static void atomic (lua_State *L) { | |||
735 | g->currentwhite = cast_byte(otherwhite(g)); | 735 | g->currentwhite = cast_byte(otherwhite(g)); |
736 | g->sweepstrgc = 0; | 736 | g->sweepstrgc = 0; |
737 | g->gcstate = GCSsweepstring; | 737 | g->gcstate = GCSsweepstring; |
738 | lua_assert(g->totalbytes > udsize); | ||
738 | g->estimate = g->totalbytes - udsize; /* first estimate */ | 739 | g->estimate = g->totalbytes - udsize; /* first estimate */ |
739 | } | 740 | } |
740 | 741 | ||
741 | 742 | ||
742 | #define correctestimate(g,s) {lu_mem old = g->totalbytes; s; \ | 743 | #define correctestimate(g,s) { \ |
743 | lua_assert(old >= g->totalbytes); g->estimate -= old - g->totalbytes;} | 744 | lu_mem old = g->totalbytes; s; \ |
745 | lua_assert(old >= g->totalbytes); \ | ||
746 | if (g->estimate >= old - g->totalbytes) \ | ||
747 | g->estimate -= (old - g->totalbytes);} | ||
744 | 748 | ||
745 | 749 | ||
746 | static l_mem singlestep (lua_State *L) { | 750 | static l_mem singlestep (lua_State *L) { |
@@ -813,7 +817,8 @@ void luaC_step (lua_State *L) { | |||
813 | } | 817 | } |
814 | } | 818 | } |
815 | else { | 819 | else { |
816 | lua_assert(g->totalbytes >= g->estimate); | 820 | if (g->estimate > g->totalbytes) |
821 | g->estimate = g->totalbytes; | ||
817 | setthreshold(g); | 822 | setthreshold(g); |
818 | } | 823 | } |
819 | } | 824 | } |