Skip site navigation (1) Skip section navigation (2)

Re: still memory leaks with libpgtcl

From: ljb <lbayuk(at)mindspring(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: still memory leaks with libpgtcl
Date: 2003-01-08 03:08:11
Message-ID: avg4mq$1ikp$ (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
g(dot)hintermayer(at)inode(dot)at wrote:
> If I'd track down the problem and sent a patch, has the wheel to be reinvented 
> for gborg ? Two concurrent developments is not a good thing.

Did you see Tom Lane's reply on this thread? The problem is known but fixing
the leak causes a crash. The code is in libpgtcl/pgtclId.c; look for this
     * XXX Unfortunately, while this works fine if we are closing due to
     * explicit pg_disconnect, Tcl versions through 8.3.3 dump core if we
     * try to do it during interpreter shutdown.  Not clear why, or if
     * there is a workaround.  For now, accept leakage of the (fairly
     * small) amount of memory taken for the channel state representation.

I've confirmed that the crash occurs with Tcl 8.3.4 also. But I've got a
patch which seems to fix it - that is, it neither leaks on disconnect nor
crashes on shutdown after my patch is applied. At least it doesn't with my
extremely minimal testing. If you want to try this, go ahead. This patch is
seriously ugly and 'highly suspect', and I am NOT suggesting this be
included in the PostgreSQL release. Really. But it works. Maybe.

(This is for PostgreSQL-7.3.1)

--- src/interfaces/libpgtcl/pgtclId.c.bak	2002-10-17 10:53:32.000000000 -0400
+++ src/interfaces/libpgtcl/pgtclId.c	2003-01-07 21:51:53.000000000 -0500
@@ -300,12 +300,10 @@
 	 * small) amount of memory taken for the channel state representation.
 	 * Note we are not leaking a socket, since libpq closed that already.
-#ifdef NOT_USED
-	if (connid->notifier_channel != NULL)
+	if (connid->notifier_channel != NULL && interp != NULL)
 		Tcl_UnregisterChannel(NULL, connid->notifier_channel);
 	 * We must use Tcl_EventuallyFree because we don't want the connid

In response to


pgsql-interfaces by date

Next:From: Hiroshi InoueDate: 2003-01-08 03:41:01
Subject: Re: MOVE LAST: why?
Previous:From: D'Arcy J.M. CainDate: 2003-01-08 02:51:48
Subject: Re: [ADMIN] is still wrong in Postgres 7.3.1 rpm

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group