summaryrefslogtreecommitdiffstats
path: root/TVout/fbset
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2024-06-28 01:38:43 +0200
committersfan5 <sfan5@live.de>2024-06-30 21:15:37 +0200
commit4969d6e03ec35ee848ee0461147189c591ad1896 (patch)
tree45919e212fbd9712a351480eb565efcf986fdb04 /TVout/fbset
parent68a1a3879ca5b65ecd1f7b63b09b615f968d807a (diff)
downloadmpv-master.tar.bz2
mpv-master.tar.xz
player/lua: restore original lua allocator before closeHEADmaster
We wrap the default Lua allocator to allow used memory tracking. This works well, except that we never destroy the default allocator or notify it that we are closing. Since we override it for the current Lua state, it is reasonable that the Lua engine does not expect it to be used. We get and pass through a free call, but in the case of LuaJIT, the internal allocator has additional state and is freed differently. So, in fact, it is a LuaJIT leak because once we replace the allocator with our custom one, they should clean its internal state. I guess the assumption is to override allocator only before any allocation happen. To work around this issue, restore the default allocator, the one that we use, before closing the state. This way, everything is cleared as expected. Note that the current solution of wrapping the default allocator works only because none of the supported Lua engines actually invalidate the allocator on the lua_setallocf() call. However, they could, so keep in mind that we are currently depending on an implementation detail. Thanks to @Dudemanguy for help with finding the changes that introduced the leak. Fixes: a67bda28409dd893617ef47f6e089fd753d7de78 Fixes: #14451
Diffstat (limited to 'TVout/fbset')
0 files changed, 0 insertions, 0 deletions