mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-27 22:55:16 +01:00
- no newproxy: LuaJIT runs a __gc without the hook, at any allocation and in lua_close, so a looping finalizer hung the worker. a table's __gc isn't run, ffi isn't opened: the screens have no finalizer of their own - render and init of the script's table are read inside the protected, counted call, as is the state table of a refresh: an __index that fails or loops switches the screen off instead of ending the program, and one that gives render works - string.find, match, gmatch and gsub are refused when the steps they may take at worst (script_screens::lua_pattern_cost) are over 1e8, about a tenth of a second of LuaJIT's backtracking - a screen holds at most 128 MB, its heap and the pixels of its images, fonts and sprites: the hook checks it with a full collection, the api reserves pixels before making them, and string.format, table.concat and string.gsub refuse a result over it from the lengths of their arguments. where LuaJIT takes an allocator of the game's (2.1 GC64) the heap gets one that refuses past twice the limit, which also stops a single large concatenation; LuaJIT 2.0 on x64 takes none - xpcall is made in Lua on top of pcall, so a coroutine yields across it - the limits go into limit_libraries(), apart from opening the libraries
5.5 KiB
5.5 KiB