powered by Jive Software

Leave() a MultiUserChat will also clean-up the registered listeners?

The doc at http://www.jivesoftware.org/builds/smack/docs/latest/javadoc/org/jivesoftware/sm ackx/muc/MultiUserChat.html#leave()

doesn’'t specify this: can I proceed confidend that doing something like:

void closeConference() {


muc = null;


is enough() or have I to manually remove all the listeners I registered at creation time?

The best practice to get in the habit of is to generally remove all listeners you create. The MUC cleans up its resources at finalize time, so if either of the objects the MUC or the object you have listening to the MUC have strong references somewhere in your program this finalize method will not be called and both the objects will remain in memory indefintly.

Though, if you don’'t have any strong references to the object you are listening on, you should be fine, I would still recomend that you manually remove the listeners to be assured of the objects garbage collection.


Ok, I’'ll keep the safe way and track all of my listeners, removing them when I call leave(). Thanks.