This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Memory leak with Sockets?
- From: Bryce McKinlay <bryce at mckinlay dot net dot nz>
- To: Stanley Brown <stanley dot brown at zimmer dot com>
- Cc: java at gcc dot gnu dot org
- Date: Fri, 31 Oct 2003 11:49:13 +1300
- Subject: Re: Memory leak with Sockets?
- References: <3FA17F40.5060600@zimmer.com>
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