Re: Release connections in MODPERL

From: "D(dot) Duccini" <duccini(at)backpack(dot)com>
To: "Brett W(dot) McCoy" <bmccoy(at)chapelperilous(dot)net>
Cc: Pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Release connections in MODPERL
Date: 2001-01-11 04:26:41
Message-ID: Pine.GSO.4.03.10101102222130.15889-100000@ra.bpsi.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


Get this, all it takes to release the connection (since PQfinish() doesn't
work and there isn't any Pg::disconnectdb() )

is to set the your handle to null !!

PERL's garbage collection picks it up and voila! no extra processes
hanging in memory.

so if you do this:

$DBNAME = 'template1';
$SQLCONNECT = "dbname = " . $DBNAME;
$SQL = Pg::connectdb($SQLCONNECT);

you can simply do this:

$SQL = null;

otherwise Apache/modperl holds onto the connection and the number of
postmaster tasks in memory grows

-----------------------------------------------------------------------------
david(at)backpack(dot)com BackPack Software, Inc. www.backpack.com
+1 651.645.7550 voice "Life is an Adventure.
+1 651.645.9798 fax Don't forget your BackPack!"
-----------------------------------------------------------------------------

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message D. Duccini 2001-01-11 05:01:23 Re: Release connections in MODPERL
Previous Message Brett W. McCoy 2001-01-11 03:17:49 Re: Release connections in MODPERL