Re: Backend memory dump analysis

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)anarazel(dot)de>
Cc: Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Backend memory dump analysis
Date: 2018-03-27 23:32:54
Message-ID: 8ecf710d-4562-0f94-0c23-6793c7fc71a2@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 3/27/18 12:47, Tom Lane wrote:
> Here's an updated patch that adjusts the output format per discussion:
>
> - context identifier at the end of the line, so it's easier to see the
> numbers
>
> - identifiers truncated at 100 bytes, control characters replaced by
> spaces
>
> Also, I hacked things so that dynahash hash tables continue to print
> the way they did before, since the hash table name is really what
> you want to see there.
>
> Sample output is same test case as last time (dump at end of plpgsql.sql
> regression test script).
>
> Barring objection I plan to push this shortly.

Cool.

How about this one as well:

diff --git a/src/backend/utils/mmgr/portalmem.c
b/src/backend/utils/mmgr/portalmem.c
index 75a6dde32b..c08dc260e2 100644
--- a/src/backend/utils/mmgr/portalmem.c
+++ b/src/backend/utils/mmgr/portalmem.c
@@ -200,6 +200,7 @@ CreatePortal(const char *name, bool allowDup, bool
dupSilent)
portal->portalContext = AllocSetContextCreate(TopPortalContext,
"PortalContext",
ALLOCSET_SMALL_SIZES);
+ MemoryContextCopySetIdentifier(portal->portalContext, name);

/* create a resource owner for the portal */
portal->resowner = ResourceOwnerCreate(CurTransactionResourceOwner,

The term CopySetIdentifier has confused me a bit. (What's a "set
identifier"?) Maybe use CopyAndSetIdentifier? (We similarly have
MemoryContextResetAndDeleteChildren.)

I'm also not clear why this doesn't undo the previous optimization that
preferred making the identifier a compile time-constant. Aren't we now
just going back to doing a pstrdup() every time?

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-03-27 23:55:49 Re: Backend memory dump analysis
Previous Message Andrew Dunstan 2018-03-27 23:32:03 Re: Undesirable entries in typedefs list