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 DA4E711F6A98 for ; Tue, 4 Apr 2006 17:06:23 -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 68269-01 for ; Tue, 4 Apr 2006 17:06:23 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 7F95C11F6A9E for ; Tue, 4 Apr 2006 17:06:21 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k34K66n9014007; Tue, 4 Apr 2006 16:06:06 -0400 (EDT) To: Keary Suska cc: Postgres-Interfaces Subject: Re: Memory Usage and libpq In-reply-to: References: Comments: In-reply-to Keary Suska message dated "Tue, 04 Apr 2006 12:14:52 -0700" Date: Tue, 04 Apr 2006 16:06:06 -0400 Message-ID: <14006.1144181166@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.114 required=5 tests=[AWL=0.114] X-Spam-Score: 0.114 X-Spam-Level: X-Archive-Number: 200604/6 X-Sequence-Number: 6097 Keary Suska writes: > 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. This would depend entirely on how malloc/free are implemented on your platform. Some versions can release space back to the OS, some can't. In some it depends on what else has been allocated. regards, tom lane