Re: Exporting closePGconn from libpq

From: Markus Wanner <markus(at)bluegap(dot)ch>
To: Leon Smith <leon(dot)p(dot)smith(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Exporting closePGconn from libpq
Date: 2011-05-16 08:46:26
Message-ID: 4DD0E462.8010406@bluegap.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2011-05-16 12:16:51 Re: Exporting closePGconn from libpq
Previous Message Magnus Hagander 2011-05-16 08:09:17 Re: Isolation checks under MSVC