executor.scheduleWithFixedDelay(Main::xmppConnect, 0, 1, TimeUnit.SECONDS);
xmppConnect(){
// 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().
executor.scheduleWithFixedDelay(Main::xmppConnect, 0, 1, TimeUnit.SECONDS);
xmppConnect(){
// 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.
This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.