ThaliCore has several strong reference cycles that prevent instances from being deallocated.
Most of class instances in ThaliCore are keep alive forever: sessions, virtualsockets, tcpclients, tcplisteners and so on, are never deallocated.
This is not only causing memory leaks, it may as well be the root cause of https://github.com/thaliproject/Thali_CordovaPlugin/issues/1891
We believe we have fixed most, if not all, of them. Let's consider this issue resolved and we will open new issues for specific cases if more strong reference cycles will be found.
ThaliCore has several strong reference cycles that prevent instances from being deallocated. Most of class instances in ThaliCore are keep alive forever: sessions, virtualsockets, tcpclients, tcplisteners and so on, are never deallocated. This is not only causing memory leaks, it may as well be the root cause of https://github.com/thaliproject/Thali_CordovaPlugin/issues/1891
The strong reference cycle is often occurring because of strong function references when passing callback handlers, the problem and a method to solve it is well described in this article: http://sveinhal.github.io/2016/03/16/retain-cycles-function-references/