| 608 | |
| 609 | |
| 610 | void luaC_step (lua_State *L) { |
| 611 | global_State *g = G(L); |
| 612 | l_mem lim = (GCSTEPSIZE/100) * g->gcstepmul; |
| 613 | if (lim == 0) |
| 614 | lim = (MAX_LUMEM-1)/2; /* no limit */ |
| 615 | g->gcdept += g->totalbytes - g->GCthreshold; |
| 616 | do { |
| 617 | lim -= singlestep(L); |
| 618 | if (g->gcstate == GCSpause) |
| 619 | break; |
| 620 | } while (lim > 0); |
| 621 | if (g->gcstate != GCSpause) { |
| 622 | if (g->gcdept < GCSTEPSIZE) |
| 623 | g->GCthreshold = g->totalbytes + GCSTEPSIZE; /* - lim/g->gcstepmul;*/ |
| 624 | else { |
| 625 | g->gcdept -= GCSTEPSIZE; |
| 626 | g->GCthreshold = g->totalbytes; |
| 627 | } |
| 628 | } |
| 629 | else { |
| 630 | setthreshold(g); |
| 631 | } |
| 632 | } |
| 633 | |
| 634 | |
| 635 | void luaC_fullgc (lua_State *L) { |