### Description
<!-- Explain what you did, what you expected to happen, and what actually happened. --> We are buidling some kind of our own rtpengine dispatcher based on our own algorithm using kemi Lua.
In one of the functions we are calling:
`local reqBody = function(command, params)
return json.encode({ jsonrpc = "2.0", method = "rtpengine." .. command, params = params })
end
KSR.jsonrpcs.exec(reqBody("show", { "all" })) local data = json.decode(KSR.pv.get("$jsonrpl(body)")) ` And watching **free_mem** decrasing in case of every call of this function
If we are commenting this - nothing happens
P.S. We are doing the same for the dispatcher module but did not find memory leak for it:
`local reqBody = function (command,params)
return json.encode( { jsonrpc = "2.0", method = "dispatcher." ..command, params = params } )
end
KSR.jsonrpcs.exec(reqBody( "list" ) ) local data = json.decode( KSR.pv.get("$jsonrpl(body)") ) ` ### Troubleshooting
#### Reproduction
To reproduce this issue suppose will be enough to call code above #### Debugging Data
test results for 10000 calls total/300 per second (sipp based)
memory stats on the start
shmem:fragments = 2 | shmem:free_size = 63131408 shmem:max_used_size = 3994704 shmem:real_used_size = 3977456 shmem:total_size = 67108864 shmem:used_size = 3205144
memory stats on the end
shmem:fragments = 5 | shmem:free_size = 60106232 shmem:max_used_size = 7019952 shmem:real_used_size = 7002632 shmem:total_size = 67108864 shmem:used_size = 4150008
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
``` version: kamailio 5.1.6 (x86_64/linux) 7d1964 flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144 MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB poll method support: poll, epoll_lt, epoll_et, sigio_rt, select. id: 7d1964 compiled on 03:23:23 Oct 5 2018 with gcc 6.3.0 ```
* **Operating System**:
<!-- Details about the operating system, the type: Linux (e.g.,: Debian 8.4, Ubuntu 16.04, CentOS 7.1, ...), MacOS, xBSD, Solaris, ...; Kernel details (output of `uname -a`) -->
``` 1 machine: SMP Debian 4.9.110-3+deb9u6 (2018-10-08) x86_64 GNU/Linux 2 machine: SMP Debian 4.9.110-3+deb9u2 (2018-08-13) x86_64 GNU/Linux ``` If will need any additional info just let me know P.S. We also tried to find what can give this behavior on the rtpengine.c but didn't figured out yet
found reason It was about rtpeninge.rtp.manage() we did not expect behavior that if not call manage for the BYE request - it will keep something in the memory of the kamailio
Closed #1778.