** In case of allocation fail, this function will call the GC to try ** to free some memory and then try the allocation again. ** (It should not be called when shrinking a block, because then the ** interpreter may be in the middle of a collection step.) */
| 144 | ** interpreter may be in the middle of a collection step.) |
| 145 | */ |
| 146 | static void *tryagain (lua_State *L, void *block, |
| 147 | size_t osize, size_t nsize) { |
| 148 | global_State *g = G(L); |
| 149 | if (ttisnil(&g->nilvalue)) { /* is state fully build? */ |
| 150 | luaC_fullgc(L, 1); /* try to free some memory... */ |
| 151 | return (*g->frealloc)(g->ud, block, osize, nsize); /* try again */ |
| 152 | } |
| 153 | else return NULL; /* cannot free any memory without a full state */ |
| 154 | } |
| 155 | |
| 156 | |
| 157 | /* |
no test coverage detected