| От | Tom Lane |
|---|---|
| Тема | Re: Bug #548: Misleading documentation of `palloc' |
| Дата | |
| Msg-id | 4498.1009988888@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Bug #548: Misleading documentation of `palloc' (pgsql-bugs@postgresql.org) |
| Список | pgsql-bugs |
pgsql-bugs@postgresql.org writes:
> I propose to make the documentation more concise in this point and to
> add a macro like:
> #define palloc_tx(sz) MemoryContextAlloc(TopTransactionContext, (sz))
I don't think it's a good idea to encourage people to allocate in
TopTransactionContext as a substitute for thought. One of the main
reasons for developing the memory context mechanism was to get rid
of transaction-duration memory leaks. People who want to allocate
storage that will outlive a single function call need to think about
exactly how long it needs to live and when/where/how it will be
released.
I agree that the particular paragraph you identified is oversimplified,
but the right thing is to fix the documentation not add another layer
of oversimplification.
regards, tom lane
В списке pgsql-bugs по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера