From: | Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com> |
---|---|
To: | Andres Freund <andres(at)anarazel(dot)de> |
Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: When is the MessageContext released? |
Date: | 2019-02-27 10:59:13 |
Message-ID: | CAKU4AWqsCRp-uZK4AJ8u+QfCjNk9LJ9KUExAhBW7t1XPga_1Lw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Thanks you Andres for your time! this context is free with AllocSetReset
rather than AllocSetDelete, that makes my breakpoint doesn't catch it.
On Wed, Feb 27, 2019 at 2:15 PM Andres Freund <andres(at)anarazel(dot)de> wrote:
> On 2019-02-27 14:08:47 +0800, Andy Fan wrote:
> > Hi :
> > I run a query like "select * from t" and set the break like this:
> >
> > break exec_simple_query
> > break MemoryContextDelete
> > commands
> > p context->name
> > c
> > end
> >
> > I can see most of the MemoryContext is relased, but never MessageContext,
> > when will it be released?
>
> It's released above exec_simple_query, as it actually contains the data
> that lead us to call exec_simple_query(). See the main for loop in
> PostgresMain():
>
> /*
> * Release storage left over from prior query cycle, and
> create a new
> * query input buffer in the cleared MessageContext.
> */
> MemoryContextSwitchTo(MessageContext);
> MemoryContextResetAndDeleteChildren(MessageContext);
>
> Greetings,
>
> Andres Freund
>
From | Date | Subject | |
---|---|---|---|
Next Message | Andy Fan | 2019-02-27 11:11:54 | some hints to understand the plsql cursor. |
Previous Message | Fabien COELHO | 2019-02-27 10:50:17 | Re: get_controlfile() can leak fds in the backend |