From: | "Heiko W(dot) Rupp" <hwr(at)pilhuhn(dot)de> |
---|---|
To: | Vitalii Tymchyshyn <vit(at)tym(dot)im> |
Cc: | Tom Dunstan <pgsql(at)tomd(dot)cc>, PG-JDBC Mailing List <pgsql-jdbc(at)postgresql(dot)org>, Dave Cramer <pg(at)fastcrypt(dot)com> |
Subject: | Re: Remove usage of finalizers ? |
Date: | 2013-10-23 05:58:57 |
Message-ID: | 4EFCA605-80FE-4D6F-90CE-C124984C95AB@pilhuhn.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Vitalii,
Am 23.10.2013 um 02:36 schrieb Vitalii Tymchyshyn:
> As for me, introducing server-side leak would be plain wrong. If it will be done, please announce in the list, I will stop recommending using postgresql in java projects.
*relying* on Finalizers to clean up server side state may introduce those leaks in the first place, as
finalizers are not guaranteed to be called at all.
In my case we had 290k Statements in the queue to be finalized, when the JVM started to throw
OutOfMemoryErrors. At that point no one will those finalize() methods be called here.
Also there is no guarantee when the finalizer runs other than after completed construction
and before the memory is finally released by the garbage collector.
Objects to be finalized could thus hold references to pg-server side resources for hours,
which is not what you want for short lived simple statements.
And as Dave said, Statements are supposed to be explicitly close()d by the application.
From | Date | Subject | |
---|---|---|---|
Next Message | Heiko W. Rupp | 2013-10-23 06:05:04 | Re: Remove usage of finalizers ? |
Previous Message | Tom Dunstan | 2013-10-23 04:07:33 | Re: Remove usage of finalizers ? |