| От | Tom Lane |
|---|---|
| Тема | Re: Freeing transient memory in aggregate functions |
| Дата | |
| Msg-id | 2658304.1640035505@sss.pgh.pa.us обсуждение |
| Ответ на | Freeing transient memory in aggregate functions (Matt Magoffin <postgresql.org@msqr.us>) |
| Список | pgsql-general |
Matt Magoffin <postgresql.org@msqr.us> writes:
> I’m essentially doing a datumCopy() on every non-null input value.
If you're doing that in the aggContext, you definitely need to free
the prior one(s).
> I was wondering if there is a way to free the previously copied datum, since I don’t really need it anymore?
Somethinglike
> if (state->last != NULL) {
> pfree(state->last);
> }
Not quite like that. Look into nodeAgg.c, which solves a similar problem
for the transvalues themselves with code like
/* forget the old value, if any */
if (!oldIsNull && !pertrans->inputtypeByVal)
pfree(DatumGetPointer(oldVal));
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера