Re: pointer scope and memory contexts - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pointer scope and memory contexts
Date
Msg-id 15359.1225978088@sss.pgh.pa.us
Whole thread Raw
In response to pointer scope and memory contexts  ("Tim Keitt" <tkeitt@keittlab.org>)
List pgsql-hackers
"Tim Keitt" <tkeitt@keittlab.org> writes:
> [questions]

Switching memory contexts, in itself, only switches which context a bare
palloc() will allocate from (as opposed to MemoryContextAlloc).  It
cannot have some magic impact on the validity of existing pointers.

> One last question: if I call SPI_finish, on the first call, do I need
> to switch contexts in the per-call section? (I saw some example code
> that suggested one needs to switch contexts back to
> multi_call_memory_ctx after SPI_finish.)

I believe SPI_finish will switch back to the context that was current
when SPI_connect was called.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Jaime Casanova"
Date:
Subject: Re: regression in analyze
Next
From: Tom Lane
Date:
Subject: Re: plperl needs upgrade for Fedora 10