Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <assert.h>
- #include <unistd.h>
- #include <fcntl.h>
- #include <lua/lua.h>
- #include <lua/lauxlib.h>
- #include <lua/lualib.h>
- int main(int argc, char **argv) {
- long long i = 0;
- int superbigref = LUA_NOREF;
- char *superbig = malloc(4096);
- int fd = open("/dev/urandom", O_RDWR);
- lua_State *L = luaL_newstate();
- luaL_openlibs(L);
- assert(superbig); assert(L);
- lua_createtable(L, 0, 0);
- for (i = 0; i < (1UL << 19); i++) {
- read(fd, superbig, 4096);
- lua_pushlstring(L, superbig, 4096);
- superbigref = luaL_ref(L, 1);
- luaL_unref(L, 1, superbigref);
- }
- lua_close(L);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment