Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <assert.h>
- #include <string.h>
- #include <lua/lua.h>
- #include <lua/lauxlib.h>
- int ud_gc(lua_State *L) {
- return 0;
- }
- int main(int argc, char **argv) {
- long long i = 0;
- int base;
- int ref = LUA_NOREF;
- lua_State *L = luaL_newstate();
- assert(L);
- lua_createtable(L, 0, 0);
- luaL_newmetatable(L, "mt");
- lua_pushcfunction(L, ud_gc);
- lua_setfield(L, -2, "__gc");
- lua_pop(L, 1);
- for (i = 0; i < (1UL << 24); i++) {
- void *ptr;
- ptr = lua_newuserdata(L, 4096);
- luaL_setmetatable(L, "mt");
- ref = luaL_ref(L, 1);
- luaL_unref(L, 1, ref);
- }
- lua_close(L);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement