Re: Bug (and fix): leaks of TCP connections when connected - Mailing list pgsql-jdbc

From David Wall
Subject Re: Bug (and fix): leaks of TCP connections when connected
Date
Msg-id 012401c45868$87cf2840$3201a8c0@rasta
Whole thread Raw
In response to Re: Bug (and fix): leaks of TCP connections when connected  (Laurent Sylvain <sylvain.laurent@elca.ch>)
Responses Re: Bug (and fix): leaks of TCP connections when connected  ("Marcus Andree S. Magalhaes" <marcus.magalhaes@vlinfo.com.br>)
List pgsql-jdbc
> There's no finalizer on the Socket class that closes it so that even if it
> is garbage collected, the socket is not closed at the OS level. I think I
> saw somewhere this was done by design and actually I believe it's much
> cleaner to properly close the socket before losing any reference to it so
> that OS resources are freed as early as possible. Much better for
> scalability ;-)

"By design," huh?  We call such thinking: bugs on purpose (also known to the
anti-MSFT crowd as windows programming). <smile>

Yes, it's best to clean up.  But no, a finalizer should discard any open
resources as that what it was designed for.  After all, if the object is
GCed, then nobody is using it, so nobody ever will close it.  At any rate,
sounds like the PG team has already fixed the leak in its code.  Thanks
guys.

David


pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: Bug (and fix): leaks of TCP connections when connected
Next
From: "Marcus Andree S. Magalhaes"
Date:
Subject: Re: Bug (and fix): leaks of TCP connections when connected