From: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
---|---|
To: | Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Memory Accounting |
Date: | 2019-07-22 08:30:37 |
Message-ID: | 8456dbe6-2245-6a6d-03af-bb62d1615782@iki.fi |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 18/07/2019 21:24, Jeff Davis wrote:
> Previous discussion:
> https://postgr.es/m/1407012053.15301.53.camel%40jeff-desktop
>
> This patch introduces a way to ask a memory context how much memory it
> currently has allocated. Each time a new block (not an individual
> chunk, but a new malloc'd block) is allocated, it increments a struct
> member; and each time a block is free'd, it decrements the struct
> member. So it tracks blocks allocated by malloc, not what is actually
> used for chunks allocated by palloc.
>
> The purpose is for Memory Bounded Hash Aggregation, but it may be
> useful in more cases as we try to better adapt to and control memory
> usage at execution time.
Seems handy.
> * I changed it to only update mem_allocated for the current context,
> not recursively for all parent contexts. It's now up to the function
> that reports memory usage to recurse or not (as needed).
Is that OK for memory bounded hash aggregation? Might there be a lot of
sub-contexts during hash aggregation?
- Heikki
From | Date | Subject | |
---|---|---|---|
Next Message | Kyotaro Horiguchi | 2019-07-22 08:30:39 | Re: progress report for ANALYZE |
Previous Message | Michael Paquier | 2019-07-22 08:23:18 | Re: Compile from source using latest Microsoft Windows SDK |