Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VZ2hM-0004gk-Tz for pgsql-jdbc@arkaria.postgresql.org; Wed, 23 Oct 2013 17:58:25 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VZ2hM-0004PQ-7G for pgsql-jdbc@arkaria.postgresql.org; Wed, 23 Oct 2013 17:58:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VZ2hL-0004PJ-5G for pgsql-jdbc@postgresql.org; Wed, 23 Oct 2013 17:58:23 +0000 Received: from mail-qa0-x22a.google.com ([2607:f8b0:400d:c00::22a]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VZ2hG-0006B2-QJ for pgsql-jdbc@postgresql.org; Wed, 23 Oct 2013 17:58:22 +0000 Received: by mail-qa0-f42.google.com with SMTP id w8so4381090qac.8 for ; Wed, 23 Oct 2013 10:58:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; bh=qcTHD5M91EEbaoyiqZMHip3s7YPzBPPVnCicUfloClo=; b=iK7Cwx8TeyGknFIfudIa4RmtSZG7RWK8x6tKEbpNgAiifudYUJziN40f9P+N9QqDmv V0goW6WfZM3GzmUTz19w0S9EfBdya6whlONp48skM0pW8zXgt2NcJSEj4AOeOG+wQsuu M6J27+bhzuNSFXoRHj8+5tMUpVlDxZPAyOvJInjXTfjwjbkUsT4u20AmyDtqAcc8ZiKB uMiYvCodFl3m2qnptBb/Mh676bEg1cWCoBYH/mryh7PxU/MggFnekZHq/DHSGc1ri2eB 8DJ0HoZ5yCcxHuBKJ7cZWIjjvflDYIlG2rlPO8081zpyzdcOAVRLyzptSe3Mvgx+Uk/y Z8Yw== X-Received: by 10.49.39.39 with SMTP id m7mr3953643qek.60.1382551097371; Wed, 23 Oct 2013 10:58:17 -0700 (PDT) Received: from [64.102.174.132] ([64.102.174.132]) by mx.google.com with ESMTPSA id x1sm63740346qai.6.2013.10.23.10.58.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 23 Oct 2013 10:58:16 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Subject: Re: Remove usage of finalizers ? From: Adib Saikali In-Reply-To: Date: Wed, 23 Oct 2013 13:58:15 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: <283F612E-688B-4342-A924-EF67EF86A20A@gmail.com> References: <9E5438C0-0A2E-4543-BE06-1E7A6D0E3B83@pilhuhn.de> <4EFCA605-80FE-4D6F-90CE-C124984C95AB@pilhuhn.de> <52677946.4090907@hogranch.com> To: pgsql-jdbc@postgresql.org X-Mailer: Apple Mail (2.1510) X-Pg-Spam-Score: -2.0 (--) 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 Seems to me that PhantomReferences can solve this problem as they will prov= ide the ability to the cleanup without causing the performance issues with = the finalizers. I am not familiar with the postgres jdbc driver code base s= o I have no idea how much work is involved in switching from finalizers to = phantom references.=20 Can anyone with knowledge of the jdbc code base comment on the practicality= of moving from finalizers to phantom reference. On 2013-10-23, at 1:47 PM, Steven Schlansker w= rote: >=20 > On Oct 23, 2013, at 12:22 AM, John R Pierce wrote: >=20 >> On 10/23/2013 12:06 AM, Vitalii Tymchyshyn wrote: >>> I am not big fan of finalizes. But you propose to remove mechanism that= works most times, without introducing anything else. >>> You are saying that as in my incorrect application (and I am 95% sure y= ou've got incorrect application if you are getting finalizing objects piled= up) it does not work, let's remove it altogether and make driver also wron= g. >>=20 >> as an outsider to this stuff, with only a superficial understanding of t= hese finalizers, it seems to me they should log a warning if anything leaks= to them. you don't get rid of them entirely, they provide backup sweeping= up of neglected debris.. >>=20 >=20 > The specific problem with this is that the mere presence of a non-empty f= inalizer increases the cost of object allocation and deallocation by orders= of magnitude (as is claimed by many Java performance resources). All corr= ect applications pretty much have to deallocate these objects explicitly, a= s the GC can leave the resources lying around for unbounded time. So havin= g these finalizers penalizes the correct applications (which I have not obs= erved in practice, but OP seemingly has) by some amount. >=20 >=20 > Maybe the best thing would be for the OP to distill the problem down into= a self-contained code example so we can verify that there aren't any other= errors that might be contributing to this problem? It seems that if the p= roblem was really that big, someone else would have run across it. >=20 > Best, > Steven >=20 >=20 >=20 > --=20 > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-jdbc --=20 Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc