Re: C-language functions: SRF question
От | Tom Lane |
---|---|
Тема | Re: C-language functions: SRF question |
Дата | |
Msg-id | 7867.1271183845@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: C-language functions: SRF question (Jorge Arevalo <jorgearevalo@gis4free.org>) |
Список | pgsql-general |
Jorge Arevalo <jorgearevalo@gis4free.org> 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
В списке pgsql-general по дате отправления: