Memory leak with Sockets?

Stanley Brown stanley.brown@zimmer.com
Thu Oct 30 21:13:00 GMT 2003


This took a while to find.  Problem is that I had to debug a commercial 
API to find the leak.  I was wrong in assuming it had to do with Sockets 
OR the streams.  The leak is being caused by the creation of Calender 
instances.  Heres a fast example:

while (true)
{
<msg00319.html>java.util.Calendar calendar = 
java.util.Calendar.getInstance();
}

The garbage collector is unable to reclaim the memory allocated by the 
getInstance method.  Any ideas on how to fix this problem?





More information about the Java mailing list