=?UTF-8?B?RHVuYXVza2FzIE9sZWc=?= <olegjobs@mail.ru> writes:
> And one more question, for example, I do some memory allocation via palloc in _PG_Init().
> Is this memory preserve for all life time after library is loaded into postgresql process?
Probably not --- CurrentMemoryContext would most likely be pointing at a
statement-lifespan context. If you want that behavior, I'd recommend
explicitly allocating in TopMemoryContext.
(Also, you would not be needing to ask that question if you were using
an --enable-cassert build for testing. Which is *highly* recommended
when developing C code for Postgres.)
regards, tom lane