Re: Release connections in MODPERL - Mailing list pgsql-novice

From D. Duccini
Subject Re: Release connections in MODPERL
Date
Msg-id Pine.GSO.4.03.10101102222130.15889-100000@ra.bpsi.net
Whole thread Raw
In response to Re: Release connections in MODPERL  ("Brett W. McCoy" <bmccoy@chapelperilous.net>)
Responses Re: Release connections in MODPERL
List 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@backpack.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!"
-----------------------------------------------------------------------------


pgsql-novice by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Re: MSSQL to PgSQL
Next
From: Karla Peralta
Date:
Subject: Encrypt