commit - 5e3ed27ca3a9a5ec9b82211b7c3e1131b6446082
commit + 859081df55ad5462f45ef463ff2f87d62cfe541a
blob - 2e380a389650e5c5cf6b59103523dba7113d9ab9
blob + 21fb2136d6e62c14fb86dde4b5f344542b133915
--- src/box/lua/info.c
+++ src/box/lua/info.c
lua_settable(L, -3);
lua_pushstring(L, "lua");
- lua_pushinteger(L, G(L)->gc.total);
+ lua_pushinteger(L, luaL_getgctotal(L));
lua_settable(L, -3);
return 1;
blob - 309d2b1f55743e9d1455299fc7513ff5457993f0
blob + e128b0ade0023967c6c82eafecdddf14178ed394
--- src/box/lua/slab.cc
+++ src/box/lua/slab.cc
* Lua GC heap size
*/
lua_pushstring(L, "lua");
- lua_pushinteger(L, G(L)->gc.total);
+ lua_pushinteger(L, luaL_getgctotal(L));
lua_settable(L, -3);
luaL_pushuint64(L, tuple_runtime_memory_used());
blob - bbb1bd8d45947afa954e2295c76ce6b07287b1c0
blob + 5c37d43a3c5807fbe4203c5939c8f5bdf6ea06e4
--- src/lua/utils.c
+++ src/lua/utils.c
/* Pop finalizer */
lua_pop(L, 1);
+}
+
+size_t
+luaL_getgctotal(struct lua_State *L)
+{
+ return (lua_getgccount(L) * 1024ULL) + lua_gc(L, LUA_GCCOUNTB, 0);
}
/**
blob - 21a2486ce8496a02c52ebb251ae43fb921ecfea4
blob + 7958e61327b3df5b0acbe10811d968e3d5f0bef6
--- src/lua/utils.h
+++ src/lua/utils.h
luaL_setcdatagc(struct lua_State *L, int idx);
/**
+ * @brief Return size of currently allocated memory.
+ * @param L Lua State
+ */
+size_t
+luaL_getgctotal(struct lua_State *L);
+
+/**
* @brief Return CTypeID (FFI) of given СDATA type
* @param L Lua State
* @param ctypename С type name as string (e.g. "struct request" or "uint32_t")