Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 8A286B5D8BD for ; Wed, 15 Jun 2011 13:43:30 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 48945-04 for ; Wed, 15 Jun 2011 16:43:23 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 7E6C3B5D91F for ; Wed, 15 Jun 2011 13:43:23 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p5FGhLxp012399; Wed, 15 Jun 2011 12:43:22 -0400 (EDT) To: "Yann" cc: pgsql-bugs@postgresql.org Subject: Re: BUG #6061: Progresql.exe memory usage using HOLD cursor. In-reply-to: <201106151300.p5FD0eH9036477@wwwmaster.postgresql.org> References: <201106151300.p5FD0eH9036477@wwwmaster.postgresql.org> Comments: In-reply-to "Yann" message dated "Wed, 15 Jun 2011 13:00:40 +0000" Date: Wed, 15 Jun 2011 12:43:21 -0400 Message-ID: <12398.1308156201@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201106/117 X-Sequence-Number: 30496 "Yann" writes: > The issue is that in this case all rows are store in memory instead of file > in the process postgresql.exe > I think the issue is in the file tuplestore.c. > When a tuple is added the function static void > tuplestore_puttuple_common(Tuplestorestate *state, void *tuple), USEMEM is > not called with tuple size. Hmm ... yeah, I think there's a leak there. > I think that, after adding the tuple in the array, a call to USEMEM should > be done. No, the callers of tuplestore_puttuple_common are supposed to do that. But it looks like tuplestore_putvalues() forgot to do so. So data loads that go through that particular API would miss incrementing the space counter. regards, tom lane