Memory leak with Sockets?
Bryce McKinlay
bryce@mckinlay.net.nz
Thu Oct 30 22:49:00 GMT 2003
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
More information about the Java
mailing list