This Question is Possibly Answered

1 "correct" answer available (10 pts) 2 "helpful" answers available (5 pts)
5 Replies Last post: May 17, 2008 8:16 AM by josh-parity  
Click to view kflorian's profile Bronze 4 posts since
Mar 12, 2008

Mar 14, 2008 4:49 AM

XMPPConnection memory leak


Hi all!

I'm facing memory issues with Smack API version 3.0.4:

About
10% of my XMPPConnections (and related objects) aren't
garbage-collected after disconnecting and setting the reference to null; not even by a forced collection.

I've
done some extensive testing using a memory profiler, which shows that
all of my objects (which open and disconnect the XMPPConnection) are
propperly garbage-collected - it's only org.jivesoftware objects
remaining in memory. I also made absolutely sure that
connection.disconnect() will be called on all connections before
releaseing them.

According to the memory-profiler, the
XMPPConnection objects remaining in memory are still referenced from
PrivacyListManager, ServiceDiscoveryManager and MultiUserChat$1$1 (?)
objects.

It seems that the Java garbage collection (java version
1.5.0_09) is having problems with collection large sets of objects
containting circular references.

Maybe setting some of these references to null in XMPPConnection.disconnect() would help?

Thanks for any feedback!

Florian Kirchmeir

Click to view josh-parity's profile Bronze 9 posts since
Mar 24, 2008
May 17, 2008 7:49 AM in response to: kflorian
Re: XMPPConnection memory leak

I think I'm having this issue. A long running Java application server with a MultiUserChat.

Click to view josh-parity's profile Bronze 9 posts since
Mar 24, 2008
May 17, 2008 8:16 AM in response to: josh-parity
Re: XMPPConnection memory leak