Re: allowing multiple PQclear() calls

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: allowing multiple PQclear() calls
Date: 2012-12-11 07:12:17
Message-ID: 7040.1355209937@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Josh Kupershmidt <schmiddy(at)gmail(dot)com> writes:
> Would it be crazy to add an "already_freed" flag to the pg_result
> struct which PQclear() would set, or some equivalent safety mechanism,
> to avoid this hassle for users?

Yes, it would. Once the memory has been freed, malloc() is at liberty
to give it out for some other purpose. The only way we could make that
work reliably is to permanently leak the memory occupied by the PGresult
... which I trust you will agree is a cure worse than the disease.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2012-12-11 09:14:18 Re: [BUG?] lag of minRecoveryPont in archive recovery
Previous Message Darren Duncan 2012-12-11 06:22:10 Re: MySQL search query is not executing in Postgres DB