From 1e780251aebc4103242cf60d9cba6aa2f6424f62 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Thu, 9 Apr 2020 01:54:25 +0200 Subject: lua: disable memory accounting for luajit This is a stopgap measure. In theory we could maybe poll the memory usage on luajit, but for now, simply reverting this part of fd3caa26 makes Lua work again. (And we can still collect cpu usage metrics) Proper solution pending (tm) --- player/lua.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/player/lua.c b/player/lua.c index 0c5a56ec14..abc270900b 100644 --- a/player/lua.c +++ b/player/lua.c @@ -159,6 +159,7 @@ static void steal_node_alloctions(void *tmp, mpv_node *node) talloc_steal(tmp, node_get_alloc(node)); } +#ifndef HAVE_LUAJIT // lua_Alloc compatible. Serves only to retrieve memory usage. static void *mp_lua_alloc(void *ud, void *ptr, size_t osize, size_t nsize) { @@ -182,6 +183,7 @@ static void *mp_lua_alloc(void *ud, void *ptr, size_t osize, size_t nsize) return ptr; } +#endif static struct script_ctx *get_ctx(lua_State *L) { @@ -434,7 +436,12 @@ static int load_lua(struct mp_script_args *args) goto error_out; } +#if HAVE_LUAJIT + // luajit forces the use of its internal allocator, at least on 64-bit + lua_State *L = ctx->state = luaL_newstate(); +#else lua_State *L = ctx->state = lua_newstate(mp_lua_alloc, ctx); +#endif if (!L) { MP_FATAL(ctx, "Could not initialize Lua.\n"); goto error_out; -- cgit v1.2.3