powered by Jive Software

Disconnected connection could not be gc, cause memory leak

executor.scheduleWithFixedDelay(Main::xmppConnect, 0, 1, TimeUnit.SECONDS);

// do connect(),login(),and finally disconnect()

I don’t know why those connection instance could not be gc,even I call System.gc() after disconnect().

System.gc() does not provide any guarantees at all, especially not for a full GC run. That said, my experience with memory leaks in Java tells me that it is not unlikely that those instances are still uncollected because they a still strongly referenced. But I see that you have the right tool in your hand to find that out. :slight_smile:

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.