pgsql: Invent a memory context reset/delete callback mechanism.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Invent a memory context reset/delete callback mechanism.
Date: 2015-02-27 22:17:01
Message-ID: E1YRTDR-0004to-LH@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Invent a memory context reset/delete callback mechanism.

This allows cleanup actions to be registered to be called just before a
particular memory context's contents are flushed (either by deletion or
MemoryContextReset). The patch in itself has no use-cases for this, but
several likely reasons for wanting this exist.

In passing, per discussion, rearrange some boolean fields in struct
MemoryContextData so as to avoid wasted padding space. For safety,
this requires making allowInCritSection's existence unconditional;
but I think that's a better approach than what was there anyway.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/f65e8270587f3e9b8224e20f7d020ed1f816dfe1

Modified Files
--------------
src/backend/utils/mmgr/mcxt.c | 71 ++++++++++++++++++++++++++++++++++++-----
src/include/nodes/memnodes.h | 24 +++++++++++---
src/include/utils/memutils.h | 2 ++
3 files changed, 85 insertions(+), 12 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2015-02-27 22:19:37 pgsql: Make CREATE OR REPLACE VIEW internally more consistent
Previous Message Alvaro Herrera 2015-02-27 21:59:23 pgsql: Fix a couple of trivial issues in jsonb.c

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-02-27 22:22:01 Re: MemoryContext reset/delete callbacks
Previous Message Arthur Silva 2015-02-27 22:04:07 Re: logical column ordering