From: | Matt Magoffin <postgresql(dot)org(at)msqr(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Handling memory contexts in aggregate function invoking other built-in aggregate functions |
Date: | 2021-12-04 17:56:07 |
Message-ID: | 5514A57A-967F-451A-BE04-58D97AC6480B@msqr.us |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 5/12/2021, at 5:16 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Calling numeric_avg_accum in the agg_context is unnecessary, and possibly
> counterproductive (it might leak memory in that context, since like all
> other aggregates it assumes it's called in a short-lived context).
OK, thanks for that, I’ll remove the context switch before calling numeric_avg_accum and test more.
> Are you testing in an --enable-cassert build? If not, do that;
> it might make the cause of the crashes more apparent, thanks to
> CLOBBER_FREED_MEMORY and other debug support.
I did build with --enable-cassert, and I did see the state argument pointer passed to numeric_avg_accum
as 0x7f7f7f7f7f, so now I understand why that was thanks to seeing the information about what that means on the Dev FAQ, thanks for that.
So given you didn’t say I shouldn’t be trying to invoke these aggregate functions as I’m trying to, does that mean in theory there isn’t anything inappropriate about doing this as far as you know?
Cheers,
Matt
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2021-12-04 20:04:15 | Re: Handling memory contexts in aggregate function invoking other built-in aggregate functions |
Previous Message | Tom Lane | 2021-12-04 16:16:05 | Re: Handling memory contexts in aggregate function invoking other built-in aggregate functions |