From: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
---|---|
To: | Jack Orenstein <jack(dot)orenstein(at)gmail(dot)com> |
Cc: | 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 09:42:19 |
Message-ID: | 20060920094218.GA25362@svana.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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
However, except in fairly special circumstances (eg. index comparison
functions) you don't ever need to bother with pfree(). The memory will
all be freed at the right time.
The documentation on C functions and set-returning functions also has
info about when the context is reset.
Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Kelly | 2006-09-20 10:02:48 | Re: vista |
Previous Message | Najib Abi Fadel | 2006-09-20 07:46:34 | Re: What is the Best Postgresql Load Balancing Solution available ? |