Would it be safe to do something like:
void *ud = NULL;
lua_Alloc alloc = lua_getallocf(L, &ud);
void *buf = alloc(ud, NULL, 0, newsize);
while L may be being used by another thread?
If not, would it be safe to call the allocator without calling lua_getallocf() in the same circumstance, having saved it when creating the Lua state?