diff options
author | Niklas Haas <git@haasn.xyz> | 2020-04-09 01:54:25 +0200 |
---|---|---|
committer | Niklas Haas <git@haasn.xyz> | 2020-04-09 01:56:41 +0200 |
commit | 1e780251aebc4103242cf60d9cba6aa2f6424f62 (patch) | |
tree | a4d0f5d023b72cbaed09512197130b564c43b9f9 /player/lua.c | |
parent | 71d22ee2687ee4643435a7005bbb8522875d3811 (diff) | |
download | mpv-1e780251aebc4103242cf60d9cba6aa2f6424f62.tar.bz2 mpv-1e780251aebc4103242cf60d9cba6aa2f6424f62.tar.xz |
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)
Diffstat (limited to 'player/lua.c')
-rw-r--r-- | player/lua.c | 7 |
1 files changed, 7 insertions, 0 deletions
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; |