Memory Leak caused by Socks5BytestreamManager hard references to XMPPConnection

First, thank you for the smack 4.1.2 update. The RosterGroup changes made fixed a very important memory leak for us.

After profiling with 4.1.2, I noticed another XMPPConnection memory leak. The Socks5BytestreamManager class declares a “managers” HashMap. These references prevent XMPPConnection objects from being collected. This map should probably also be a WeakHashMap.

Luckily I do not need SOCKS5 Bytstreams and I have been able to work around the issue by disabling the service, like so:

Socks5BytestreamManager.getBytestreamManager(xmppConnection).disableService();

Thanks for reporting. I missed, while working on https://github.com/igniterealtime/Smack/commit/35317a19bd373c3078ca249411de6668c 295275e, that the ‘managers’ map is non-weak. Created SMACK-679, fixed with https://github.com/Flowdalic/Smack/commit/a9741a8b1099579736b6ce130aa43c2a44312a 7b and uploaded Smack 4.1.3-SNAPSHOT.

Please test and report back.

Thanks - That does the trick. There is no longer a leak with the weak map.