diff --git a/src/scripting.c b/src/scripting.c index 73337c71..97915603 100644 --- a/src/scripting.c +++ b/src/scripting.c @@ -1221,7 +1221,7 @@ sds luaCreateFunction(client *c, lua_State *lua, robj *body) { * EVALSHA commands as EVAL using the original script. */ int retval = dictAdd(server.lua_scripts,sha,body); serverAssertWithInfo(c ? c : server.lua_client,NULL,retval == DICT_OK); - server.lua_scripts_mem += sdsZmallocSize(sha) + sdsZmallocSize(body->ptr); + server.lua_scripts_mem += sdsZmallocSize(sha) + getStringObjectSdsUsedMemory(body); incrRefCount(body); return sha; }