Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id B7FB31337BC3 for ; Thu, 17 Mar 2011 15:31:30 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 79700-04 for ; Thu, 17 Mar 2011 18:31:20 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from spinlock.commandprompt.com (host-215.commandprompt.net [207.173.203.215]) by mail.postgresql.org (Postfix) with ESMTP id 2F5BF1337BBB for ; Thu, 17 Mar 2011 15:31:19 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by spinlock.commandprompt.com (Postfix) with ESMTP id 24985348046; Thu, 17 Mar 2011 11:31:14 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at commandprompt.com Received: from spinlock.commandprompt.com ([127.0.0.1]) by localhost (spinlock.commandprompt.com.commandprompt.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id D3ApDsvJzZ8g; Thu, 17 Mar 2011 11:31:12 -0700 (PDT) Received: from perhan.alvh.no-ip.org (unknown [190.95.20.220]) by spinlock.commandprompt.com (Postfix) with ESMTPSA id DE4A9348022; Thu, 17 Mar 2011 11:31:11 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id A1F656E985; Thu, 17 Mar 2011 15:31:08 -0300 (CLST) Content-Type: text/plain; charset=UTF-8 Cc: pgsql-bugs Subject: Re: BUG #5842: Memory leak in PL/Python when taking slices of results From: Alvaro Herrera To: Daniel Popowich In-reply-to: <201101181630.p0IGU45v047971@wwwmaster.postgresql.org> References: <201101181630.p0IGU45v047971@wwwmaster.postgresql.org> Date: Thu, 17 Mar 2011 15:31:08 -0300 Message-Id: <1300386599-sup-6152@alvh.no-ip.org> User-Agent: Sup/git Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201103/240 X-Sequence-Number: 29750 Excerpts from Daniel Popowich's message of mar ene 18 13:30:04 -0300 2011: > I traced the bug to PLy_result_slice() in src/pl/plpython/plpython.c. That > function calls the python API function PyList_GetSlice() and erroneously > increments the reference count before returning the result to the caller. > PyList_GetSlice returns a *new* reference, not a borrowed one, so it should > just return the object as-is. > > A patch is attached below. Thanks, applied and backpatched all the way back to 8.2. -- Álvaro Herrera The PostgreSQL Company - Command Prompt, Inc. PostgreSQL Replication, Consulting, Custom Development, 24x7 support