Hello,
A long while back I posted about this leak but at the time I wasn't able to
really narrow down the cause of the leak. However I believe I have now
found the issue and that is whenever PJSIP receives an INVITE without an
SDP the associated dialog(s) are never freed from memory. There is
something increasing the reference counter by 1 but never decreasing it to
allow the dialog(s) to be freed.
The code to reproduce this is available from my older post here:
http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2018-February/040858.html
If you run that example and send to that process an INVITE that does not
contain an SDP, the dialog reference counter gets decreased to 4 when the
call is terminated. Associated transactions get properly destroyed but the
dialog does not.
If you then run that same example and send an INVITE that does contain an
SDP, the reference counter get decreased to 3 when the call is terminated
and the dialog gets destroyed when the associated transactions get
destroyed.
This bug still exists in both PJSIP 2.8 and the master
branch @ 8c76e17145c0856b8d925da41e1ba43062e8d2e5.