Re: Thinking about inventing MemoryContextSetParent - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Thinking about inventing MemoryContextSetParent
Date
Msg-id 1315845624-sup-9837@alvh.no-ip.org
Whole thread Raw
In response to Thinking about inventing MemoryContextSetParent  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Thinking about inventing MemoryContextSetParent
List pgsql-hackers
Excerpts from Tom Lane's message of sáb sep 10 19:03:23 -0300 2011:
> I'm considering inventing a new mcxt.c primitive,
> 
> void MemoryContextSetParent(MemoryContext context, MemoryContext new_parent);
> 
> which would have the effect of delinking "context" from its current
> parent context and attaching it as a child of the new specified parent.
> (Any child contexts that it has would naturally follow along.)
> Because of the way that mcxt.c handles parent/child links, there is no
> palloc required and so the operation cannot fail.

Interesting.  I wonder whether we could use this somehow to fix
performance problems in certain subtransaction code paths that "reassign
stuff to the parent"; instead of moving pointers or memory around,
perhaps we could do something like this.  Not that I have actually
looked into it.

-- 
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: Mark Hills
Date:
Subject: libpq: Return of NULL from PQexec
Next
From: Josh Berkus
Date:
Subject: Re: Alpha 1 for 9.2