Re: Exporting closePGconn from libpq - Mailing list pgsql-hackers

From Markus Wanner
Subject Re: Exporting closePGconn from libpq
Date
Msg-id 4DD0E462.8010406@bluegap.ch
Whole thread Raw
In response to Exporting closePGconn from libpq  (Leon Smith <leon.p.smith@gmail.com>)
List pgsql-hackers
Leon,

On 05/14/2011 05:23 PM, Leon Smith wrote:
> A minor issue has come up in creating low-level bindings to libpq for
> safe garbage-collected languages,  namely that PQfinish is the only
> (AFAICT) way to close a connection but also de-allocates the memory
> used to represent the database connection.    It would be preferable
> to call PQfinish to free the memory in a finalizer,  but appilcations
> need a way to disconnect from the database at a predictable and
> deterministic point in time,  whereas leaving a bit of memory around
> until the GC finally gets to it is relatively harmless.

It's harmless, but I think it's also useless.  Or why do you want to
keep that (libpq-private) bit of memory around beyond PQfinish()?

I'm not sure what language or VM you have in mind, but your description
sounds like you are writing a wrapper by definition.

Regards

Markus Wanner


pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: Isolation checks under MSVC
Next
From: Merlin Moncure
Date:
Subject: Re: Exporting closePGconn from libpq