pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gerhard Hintermayer <g.hintermayer@inode.at>
To: pgsql-interfaces@postgresql.org
Subject: Re: still memory leaks with libpgtcl
Date: Wed, 08 Jan 2003 07:39:05 +0100
Message-ID: <avgh9i$2hcp$1@news.hub.org> (raw)
In-Reply-To: <avg4mq$1ikp$1@news.hub.org>
References: <as0da6$2njk$1@news.hub.org>
	<auhq8v$2iuo$1@news.hub.org>
	<auj41k$f4v$1@news.hub.org>
	<avf32e$rep$1@news.hub.org>
	<avg4mq$1ikp$1@news.hub.org>

ljb wrote:

> 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 TCL_MAJOR_VERSION >= 8
> -	if (connid->notifier_channel != NULL)
> +	if (connid->notifier_channel != NULL && interp != NULL)
>  		Tcl_UnregisterChannel(NULL, connid->notifier_channel);
>  #endif
> -#endif
>  
>  	/*
>  	 * We must use Tcl_EventuallyFree because we don't want the connid

Ah, I think my brain does have memory leaks too, but I remember now, that Tom 
Lane fixed that after I found out, that the logfile was filled with "unexpected 
EOF on client connection" each time I pg_disconnected.
Does your patch produce the above log-entries ?

I'd be willing to post a question on comp.lang.tcl or dig through the 
Tcl_Channel documentation, but I still see the problem of two concurrent 
developments (gborg/libpgtcl). Gborg does heavily use Tcl_Obj instead of 
strings, and as far as I can remember, the code differs a lot, so it's likely 
that if ther's a solution in libpgtcl, it has to be dropped and searched again, 
when gborg will replace libpgtcl.
-- 
Gerhard Hintermayer
http://www.inode.at/g.hintermayer




view thread (15+ messages)  latest in thread

Message-ID: <avgh9i$2hcp$1@news.hub.org>
Permalink:  ../avgh9i$2hcp$1@news.hub.org/
Also on:    postgresql.org/message-id/avgh9i$2hcp$1@news.hub.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: g.hintermayer@inode.at
  Subject: Re: still memory leaks with libpgtcl
  In-Reply-To: <avgh9i$2hcp$1@news.hub.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox