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