Re: Backend memory dump analysis - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Backend memory dump analysis
Date
Msg-id 8ecf710d-4562-0f94-0c23-6793c7fc71a2@2ndquadrant.com
Whole thread Raw
In response to Re: Backend memory dump analysis  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Backend memory dump analysis  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Undesirable entries in typedefs list
Next
From: Tom Lane
Date:
Subject: Re: Backend memory dump analysis