Re: MemoryContextCreate change in PG 11 how should contexts becreated
От
Alvaro Herrera
Тема
Re: MemoryContextCreate change in PG 11 how should contexts becreated
Дата
Msg-id
20171219145405.gw3svtoyt6jgym52@alvherre.pgsql
Ответ на
Список
Дерево обсуждения
MemoryContextCreate change in PG 11 how should contexts be created "Regina Obe" <lr@pcorp.us>
Re: MemoryContextCreate change in PG 11 how should contexts be created Paul Ramsey <pramsey@cleverelephant.ca>
Re: MemoryContextCreate change in PG 11 how should contexts becreated Alvaro Herrera <alvherre@2ndquadrant.com>
Re: MemoryContextCreate change in PG 11 how should contexts be created Paul Ramsey <pramsey@cleverelephant.ca>
Re: MemoryContextCreate change in PG 11 how should contexts be created Tom Lane <tgl@sss.pgh.pa.us>
Re: MemoryContextCreate change in PG 11 how should contexts be created Paul Ramsey <pramsey@cleverelephant.ca>
Re: MemoryContextCreate change in PG 11 how should contexts becreated David Steele <david@pgmasters.net>
Paul Ramsey wrote: > Our use of MemoryContextCreate is solely in order to get use > MemoryContextDelete as a callback so that, at the end of a statement, > we can clean up externally allocated memory that we're holding in a > cache. You should not use MemoryContextCreate at all -- it's somewhat of an internal API, as you could guess by looking at the weird arguments that you're forced into passing. Instead, the interface you're supposed to use is AllocSetContextCreate. Just make sure you attach your new context to one which has the right lifetime for your usage -- in your case ISTM the parent should be PortalContext, which makes it go away when the current portal (query) is gone. See src/backend/utils/mmgr/README for more. This applies to all releases, old and new, though recently the API of these memory context creation functions has been refined somewhat. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
В списке pgsql-hackers по дате отправления
От: Tom Lane
Дата: