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

Re: Release connections in MODPERL

From: "Brett W(dot) McCoy" <bmccoy(at)chapelperilous(dot)net>
To: "D(dot) Duccini" <duccini(at)backpack(dot)com>
Cc: Pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Release connections in MODPERL
Date: 2001-01-11 05:03:14
Message-ID: Pine.LNX.4.30.0101102351290.19850-100000@chapelperilous.net (view raw or flat)
Thread:
Lists: pgsql-novice
On Wed, 10 Jan 2001, D. Duccini wrote:

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

Right, because it relies on the DESTROY method to be called when the
reference goes away, but this doesn't work in mod_perl, alas.

However, in DBI, you can (and should) explicitly close the database
connection with the disconnect method, if you want it closed.

> is to set the your handle to null !!
>
> PERL's garbage collection picks it up and voila!  no extra processes
> hanging in memory.

Except you mean undef, right?  There is no null in Perl.  Even so, though,
undef does not call object destructors (i.e., DESTROY method), only
decrements the reference count, which hopefully means it wil get garbage
collected.

-- Brett
                                     http://www.chapelperilous.net/~bmccoy/
---------------------------------------------------------------------------
I know not with what weapons World War III will be fought, but World
War IV will be fought with sticks and stones.
		-- Albert Einstein


In response to

Responses

pgsql-novice by date

Next:From: Brett W. McCoyDate: 2001-01-11 05:39:22
Subject: Re: Release connections in MODPERL
Previous:From: D. DucciniDate: 2001-01-11 05:01:23
Subject: Re: Release connections in MODPERL

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