Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VZ38Q-0006yS-QL for pgsql-jdbc@arkaria.postgresql.org; Wed, 23 Oct 2013 18:26:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VZ38Q-0003Uw-9G for pgsql-jdbc@arkaria.postgresql.org; Wed, 23 Oct 2013 18:26:22 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VZ38P-0003Tf-3z for pgsql-jdbc@postgresql.org; Wed, 23 Oct 2013 18:26:21 +0000 Received: from smtp-outbound-2.vmware.com ([208.91.2.13]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VZ38M-0006Wm-4e for pgsql-jdbc@postgresql.org; Wed, 23 Oct 2013 18:26:20 +0000 Received: from sc9-mailhost3.vmware.com (sc9-mailhost3.vmware.com [10.113.161.73]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id CCFDE9872A; Wed, 23 Oct 2013 11:26:16 -0700 (PDT) Received: from zcs-prod-ext-mta-1.vmware.com (zcs-prod-ext-mta-1.vmware.com [10.113.62.223]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id C7D7F40455; Wed, 23 Oct 2013 11:26:16 -0700 (PDT) Received: from zcs-prod-ext-mta-1.vmware.com (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTP id 5FF0F120033; Wed, 23 Oct 2013 11:33:19 -0700 (PDT) Received: from [192.168.1.90] (zimbra-prod-ext-proxy-vip.vmware.com [10.113.63.87]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTPSA; Wed, 23 Oct 2013 11:33:18 -0700 (PDT) Message-ID: <526814C5.8060106@vmware.com> Date: Wed, 23 Oct 2013 21:26:13 +0300 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: Steven Schlansker CC: Adib Saikali , pgsql-jdbc@postgresql.org Subject: Re: Remove usage of finalizers ? References: <9E5438C0-0A2E-4543-BE06-1E7A6D0E3B83@pilhuhn.de> <4EFCA605-80FE-4D6F-90CE-C124984C95AB@pilhuhn.de> <52677946.4090907@hogranch.com> <283F612E-688B-4342-A924-EF67EF86A20A@gmail.com> <30D0DB98-4224-425A-B99B-C4BF5CBC30AB@gmail.com> In-Reply-To: <30D0DB98-4224-425A-B99B-C4BF5CBC30AB@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -5.9 (-----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org On 23.10.2013 21:04, Steven Schlansker wrote: > > On Oct 23, 2013, at 10:58 AM, Adib Saikali wrote: > >> Seems to me that PhantomReferences can solve this problem as they will provide the ability to the cleanup without causing the performance issues with the finalizers. I am not familiar with the postgres jdbc driver code base so I have no idea how much work is involved in switching from finalizers to phantom references. >> >> Can anyone with knowledge of the jdbc code base comment on the practicality of moving from finalizers to phantom reference. > > Do we in fact know that phantom (or weak?) references are cheaper than Finalizers? Well, we *already* use phantom references to clean up server-side resources in the SimpleQuery and Portal classes. I think that's actually already enough to avoid server-side resource leaks if an application neglects to close Statements. Rather than discussing what might be the best way to use finalizers or phantom references to replace the current finalizer in the Statement class, I wish someone would just try to remove it and see what happens. - Heikki -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc