Hide
I have a simple script who does monitor the FS db.
here the miniature test script i used to test.
local api = freeswitch.API()
local endlessloop = "true"
local count = 0
repeat
count = count + 1
r = api:execute("regex", "testing1234|/(\\d+)/|$1");
if count == 10000 then endlessloop = "false"
end
until endlessloop == "false"
this does produce:
==28840== 10,222,592 bytes in 9,983 blocks are definitely lost in loss record 48 of 48
==28840== at 0x40053C0: malloc (vg_replace_malloc.c:149)
==28840== by 0x40ABEFD: API::execute(char const*, char const*) (switch_cpp.cpp:181)
==28840== by 0x125F4BFF: ??? (mod_lua_wrap.cpp:1820)
==28840== by 0x125FBAB2: luaD_precall (ldo.c:319)
==28840== by 0x12604E7F: luaV_execute (lvm.c:587)
==28840== by 0x125FBF2F: luaD_call (ldo.c:377)
==28840== by 0x125F90E0: ??? (lapi.c:800)
==28840== by 0x125FB5F2: luaD_rawrunprotected (ldo.c:116)
==28840== by 0x125FB657: luaD_pcall (ldo.c:463)
==28840== by 0x125F8F33: lua_pcall (lapi.c:821)
==28840== by 0x125DE171: ??? (mod_lua.cpp:91)
==28840== by 0x125DE70C: ??? (mod_lua.cpp:174)
==28840== LEAK SUMMARY:
==28840== definitely lost: 10,233,960 bytes in 9,991 blocks.
==28840== indirectly lost: 3,934 bytes in 24 blocks.
==28840== possibly lost: 16,544 bytes in 17 blocks.
==28840== still reachable: 351,443 bytes in 2,721 blocks.
==28840== suppressed: 0 bytes in 0 blocks.
==28840== Reachable blocks (those to which a pointer was found) are not shown.
it does not matter what is executed in the api:execute function. I used it to endless loop every 20sec after a day it's up to 400M ram usage.
Show
I have a simple script who does monitor the FS db.
here the miniature test script i used to test.
local api = freeswitch.API()
local endlessloop = "true"
local count = 0
repeat
count = count + 1
r = api:execute("regex", "testing1234|/(\\d+)/|$1");
if count == 10000 then endlessloop = "false"
end
until endlessloop == "false"
this does produce:
==28840== 10,222,592 bytes in 9,983 blocks are definitely lost in loss record 48 of 48
==28840== at 0x40053C0: malloc (vg_replace_malloc.c:149)
==28840== by 0x40ABEFD: API::execute(char const*, char const*) (switch_cpp.cpp:181)
==28840== by 0x125F4BFF: ??? (mod_lua_wrap.cpp:1820)
==28840== by 0x125FBAB2: luaD_precall (ldo.c:319)
==28840== by 0x12604E7F: luaV_execute (lvm.c:587)
==28840== by 0x125FBF2F: luaD_call (ldo.c:377)
==28840== by 0x125F90E0: ??? (lapi.c:800)
==28840== by 0x125FB5F2: luaD_rawrunprotected (ldo.c:116)
==28840== by 0x125FB657: luaD_pcall (ldo.c:463)
==28840== by 0x125F8F33: lua_pcall (lapi.c:821)
==28840== by 0x125DE171: ??? (mod_lua.cpp:91)
==28840== by 0x125DE70C: ??? (mod_lua.cpp:174)
==28840== LEAK SUMMARY:
==28840== definitely lost: 10,233,960 bytes in 9,991 blocks.
==28840== indirectly lost: 3,934 bytes in 24 blocks.
==28840== possibly lost: 16,544 bytes in 17 blocks.
==28840== still reachable: 351,443 bytes in 2,721 blocks.
==28840== suppressed: 0 bytes in 0 blocks.
==28840== Reachable blocks (those to which a pointer was found) are not shown.
it does not matter what is executed in the api:execute function. I used it to endless loop every 20sec after a day it's up to 400M ram usage.
a few lines below i spotted a API::executeString(const char *cmd)
so i try to use API::executeString with lua... and no memory problem jumping at me right away.
So i dared to modify the :
SWITCH_DECLARE(const char *) API::execute(const char *cmd, const char *arg)
{
switch_stream_handle_t stream = { 0 };
switch_assert(cmd);
this_check("");
switch_safe_free(last_data);
SWITCH_STANDARD_STREAM(stream);
switch_api_execute(cmd, arg, NULL, &stream);
last_data = (char *) stream.data;
return last_data;
}
so it does basically the same as API::executeString. I would say that inserting the missing "switch_safe_free(last_data);" did solve the problem.
I keep that now for my production env. until some one who knows better than me solves the issue.