** set a reasonable "time" to wait before starting a new GC cycle; ** cycle will start when memory use hits threshold */
| 910 | ** cycle will start when memory use hits threshold |
| 911 | */ |
| 912 | static void setpause (global_State *g, l_mem estimate) { |
| 913 | l_mem debt, threshold; |
| 914 | estimate = estimate / PAUSEADJ; /* adjust 'estimate' */ |
| 915 | threshold = (g->gcpause < MAX_LMEM / estimate) /* overflow? */ |
| 916 | ? estimate * g->gcpause /* no overflow */ |
| 917 | : MAX_LMEM; /* overflow; truncate to maximum */ |
| 918 | debt = -cast(l_mem, threshold - gettotalbytes(g)); |
| 919 | luaE_setdebt(g, debt); |
| 920 | } |
| 921 | |
| 922 | |
| 923 | #define sweepphases \ |
no test coverage detected