Re: Memory management question

From: "Serguei A(dot) Mokhov" <sa_mokho(at)alcor(dot)concordia(dot)ca>
To: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
Cc: "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Memory management question
Date: 2002-09-03 15:07:31
Message-ID: Pine.OSF.4.44.0209031106220.335885-100000@alcor.concordia.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Maybe when this thread is over, some parts of it can be
added to the dev. FAQ?

-s

On Tue, 3 Sep 2002, Karel Zak wrote:

> Date: Tue, 3 Sep 2002 13:52:09 +0200
> From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
> To: Nigel J. Andrews <nandrews(at)investsystems(dot)co(dot)uk>
> Cc: pgsql-hackers(at)postgresql(dot)org
> Subject: Re: [HACKERS] Memory management question
>
> On Tue, Sep 03, 2002 at 12:28:37PM +0100, Nigel J. Andrews wrote:
> >
> >
> > It's probably a pretty basic question explained in some document I haven't seen
> > but...if I do something like a CreateTupleDescCopy() how do I know my memory
> > context owns everything allocated without following the code all the way
> > through until it returns to me?
>
> If some code doesn't call MemoryContextSwitchTo() all is allocated in
> current memory context. You can check if CurrentMemoryContext is same
> before and after call that is important for you - but this check say
> nothing, bacuse some code can switch to other context and after usage
> switch back to your context. IMHO is not common way how check it.
> (Ok, maybe check all contexts size before/after call...)
>
> Suggestion: add to memory managment counter that handle number
> of MemoryContextSwitchTo() calls. IMHO it can be compile
> only if MEMORY_CONTEXT_CHECKING is define.
>
> But I think there is not to much places which switching between
> contexts and all are good commented (I hope, I wish :-)
>
> Karel

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Rod Taylor 2002-09-03 15:09:55 Re: possible vacuum improvement?
Previous Message Tom Lane 2002-09-03 15:01:19 Re: possible vacuum improvement?