X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5C97711F65F1 for ; Tue, 4 Apr 2006 15:24:08 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71372-06 for ; Tue, 4 Apr 2006 15:23:57 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from rhino.esc1.com (dpc67142225134.direcpc.com [67.142.225.134]) by postgresql.org (Postfix) with ESMTP id 58E9811F6C83 for ; Tue, 4 Apr 2006 15:23:51 -0300 (ADT) Received: from rhino.esc1.com (localhost.localdomain [127.0.0.1]) by rhino.esc1.com (8.12.11/8.12.11) with ESMTP id k34INMFD027043 for ; Tue, 4 Apr 2006 14:23:24 -0400 Received: from localhost (localhost [[UNIX: localhost]]) by rhino.esc1.com (8.12.11/8.12.11/Submit) id k34INLU9027041 for pgsql-interfaces@postgresql.org; Tue, 4 Apr 2006 14:23:21 -0400 From: Terry Lee Tucker Organization: Enhanced Solutions Computing To: Postgres-Interfaces Subject: Re: Memory Usage and libpq Date: Tue, 4 Apr 2006 13:23:19 -0500 User-Agent: KMail/1.5.3 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200604041423.19119.terry@esc1.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.08 required=5 tests=[AWL=0.080] X-Spam-Score: 0.08 X-Spam-Level: X-Archive-Number: 200604/2 X-Sequence-Number: 6093 On Tuesday 04 April 2006 03:14 pm, Keary Suska saith: > I am investigating a memory usage issue and I noticed something with libpq. > It appears that libpq doesn't actually free memory allocated to store > results, even after PQclear() is called. In a debug program I can inspect > the buffer so I know it exists. I haven't verified whether the buffer is > resized with subsequent calls, but when dealing with large result sets it > creates a significant memory overhead. > > Am I on to something here or do I need to keep looking? If so, is there any > way that I can force libpq to free or in some way drastically reduce this > biffer? > > Thanks, > > Keary Suska > (719) 473-6431 > (719) 440-9952 (cell) > Keary, I may be wrong about this, but just because you can access the memory after the call to PQclear, doesn't mean that the memory wasn't freed; it just means it hasn't been reused yet. The address still exists and freeing the memory doesn't "clear" it out.