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 561B011F66C8 for ; Tue, 4 Apr 2006 16:24:37 -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 61719-04 for ; Tue, 4 Apr 2006 16:24:35 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from krusty.pcisys.net (krusty.pcisys.net [216.229.32.178]) by postgresql.org (Postfix) with ESMTP id 7D12511F66C6 for ; Tue, 4 Apr 2006 16:24:34 -0300 (ADT) Received: from [192.168.0.101] (dsl-206-53-31-65.cos.pcisys.net [206.53.31.65]) by krusty.pcisys.net (8.13.3/8.13.3) with ESMTP id k34JOXWS002448 for ; Tue, 4 Apr 2006 13:24:33 -0600 (MDT) User-Agent: Microsoft-Entourage/10.1.4.030702.0 Date: Tue, 04 Apr 2006 13:24:38 -0700 Subject: Re: Memory Usage and libpq From: Keary Suska To: Postgres-Interfaces Message-ID: In-Reply-To: <200604041423.19119.terry@esc1.com> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.111 required=5 tests=[AWL=0.111] X-Spam-Score: 0.111 X-Spam-Level: X-Archive-Number: 200604/4 X-Sequence-Number: 6095 on 4/4/06 11:23 AM, terry@esc1.com purportedly said: > > 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? > > 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. It almost goes without saying, but it does encourage me to question whether my debug program is showing deallocated memory, or further, if for some reason the system/runtime isn't giving the memory back to the kernel (something I am pursuing elsewhere). I will run a test of my own and see if my debug program is showing deallocated memory. Thanks, Keary Suska Esoteritech, Inc. "Demystifying technology for your home or business"