This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Memory leak with Sockets?


On Oct 31, 2003, at 10:14 AM, Stanley Brown wrote:

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?

Yes, there was a bug in the stack tracing code which shows up here because calendar does a calling-classloader check. Fixed in current CVS - see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12475


Regards

Bryce



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]