Memory Leak without listening on Packets

Hi Everyone!

I’‘m using smack lib in a small client implementation. My client’‘s only purpose is to obtain presence information from all users listed in the Roster of a static user account. Therefore I’‘ve implemented a RosterListener and in case of network errors a ConnectionListener as well. What I don’‘t do (because I don’‘t need it - as I think) is listening for incoming messages / packets, meaning I’'ve ignored the PacketCollector/Listener stuff. However my client runs 24 hours a day and after a while I get a java heap space overflow. Do I have to listen for incoming packets and then just drop them or is there any issue with the Roster/RosterListener classes concerning memory leaks?

Thanks in advance.

Hey HFaust,

Welcome to the forums! We are aware of a memory leak in the way that PacketCollectors hold packets (they hold them indefintly) we have been working on a fix for this. I am interested to know the specific PacketListener which is causing the issue for you - PacketListener wraps PacketCollector, or if there is an errant PacketCollector. If you could hook up a profiler to your program it will help us diagnose what is going on. I will attempt to reproduce on my end. Which version of Smack are you using?



Hi Alex!

Thanks for your response. As I’‘ve tried to explain in my posting, I’‘m actually not using any PacketListener (nor PacketCollector) at all. That’‘s why I’‘m a little confused. I thought not implementing this interface results in the messages (sent to my simple client) remaining on the server. But as a matter of fact, my application’‘s heap space is growing and I’'ve pinpointed this fact to the usage of the smack library (version 2.2.1, cross-platform build, June 12., 2006) and the established connection to the server. Does the org.jivesoftware.smack.XMPPConnection class automatically receive and store incoming packets once login is processed?




Yes, there are PacketListeners automatically created by Smack. I will look into which ones are created and see if I can’'t diagnose what is the issue.