Re: BUG #15592: Memory overuse with subquery containing unnest() and set operations (11.x regression) - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #15592: Memory overuse with subquery containing unnest() and set operations (11.x regression)
Date
Msg-id 27649.1547485075@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #15592: Memory overuse with subquery containing unnest() and set operations (11.x regression)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #15592: Memory overuse with subquery containing unnest() andset operations (11.x regression)  (Andres Freund <andres@anarazel.de>)
List pgsql-bugs
I wrote:
> Andres Freund <andres@anarazel.de> writes:
>> Think I know where the problem is - let me have a coffee and check? I think I might have a good lying around...

> I had just determined that the extra context was added by bf6c614a2,

The short answer here is that this addition to BuildTupleHashTable:

    hashtable->exprcontext = CreateExprContext(parent->state);

allocates memory that is not freed by freeing the hashtable's tablecxt,
breaking the API for grouping hashtables.

Why does a hashtable need its own exprcontext now when it didn't before?

            regards, tom lane


pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #15592: Memory overuse with subquery containing unnest() and set operations (11.x regression)
Next
From: Stephen Frost
Date:
Subject: Re: BUG #15591: pg_receivewal does not honor replication slots