From: | "Jack Orenstein" <jack(dot)orenstein(at)gmail(dot)com> |
---|---|
To: | "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, "Jack Orenstein" <jack(dot)orenstein(at)gmail(dot)com>, "Andrew - Supernews" <andrew(at)supernews(dot)net>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Initializing Datums for use with SPI_execute_plan |
Date: | 2006-09-20 15:02:46 |
Message-ID: | 7ecd811f0609200802mf6f6802g181faa620bf4e930@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 9/20/06, Martijn van Oosterhout <kleptog(at)svana(dot)org> wrote:
> On Tue, Sep 19, 2006 at 04:00:43PM -0400, Jack Orenstein wrote:
> > Can you provide some guidance (or point to some documentation) on how
> > to manage memory? Is the idea that I should (must?) not pfree
> > palloc'ed memory from Int64GetDatum, but I should free anything I
> > allocate myself using palloc? Or not even that?
>
> If you want the gory details, check out the mmgr README file.
>
> http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mmgr/README?rev=1.9
Thank you, that is a useful document. So let me make sure I understand:
- My C function is invoked in a MessageContext (which you referred to
in an earlier message as a short-lived context).
- In such a context, I do not need to pfree anything, including memory
that I palloc myself, and plans returned by SPI_prepare invocations,
(assuming that I don't hold onto these things past the function
invocation, e.g. in a static).
Is that correct?
Jack
From | Date | Subject | |
---|---|---|---|
Next Message | Tomasz Ostrowski | 2006-09-20 15:07:32 | Re: Memory efficient insertion/retrieval of bytea |
Previous Message | Tom Lane | 2006-09-20 15:01:26 | Re: Strange database corruption with PostgreSQL 7.4.x o n Debian Sarge |