Search Postgresql Archives

Re: C-language functions: SRF question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jorge Arevalo <jorgearevalo@xxxxxxxxxxxx> writes:
> BTW, this code is for WKT Raster. A PostGIS extension. We can use the
> memory context I said (fcinfo->flinfo->fn_mcxt) to allocate memory
> when we need to call one of our functions from a standard "version 1"
> function, but is this the right context? I mean, the context we should
> use for a whole-plugin-lifetime persistence.

fn_mcxt will typically point at a query-lifespan context.  If you need
to allocate storage that will live as long as the session, there's not
that much reason not to use malloc, except perhaps that you have to
remember to do your own out-of-memory-failure checks.  The typical
coding pattern in the backend for session-lifespan storage is to use
TopMemoryContext, or possibly make your own context (as a child of
TopMemoryContext) so that you can easily identify how much storage
you're using for this purpose.

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux