Re: Memory-context slinging - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Memory-context slinging
Date
Msg-id Pine.LNX.4.21.0007042111030.3542-100000@localhost.localdomain
Whole thread Raw
In response to Memory-context slinging  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Memory-context slinging
List pgsql-hackers
Tom Lane writes:

> If you really truly want a context that's destroyed by elog(ERROR),
> and not by any other event, then create it as a child of ErrorContext,
> and that's what will happen.  But I suspect what you really want is a
> context that's a child of TopTransactionContext and will go away at
> either transaction commit or transaction abort.

No, actually I wanted the former. Notice how the configuration file is
first read in completely as a linked list. When something goes wrong
(garbage in the file) I need to free the list (and other things) before
calling elog. The alternative would be to create a separate memory context
for this processing, but that's more of a purity issue, it wouldn't make
it work better, AFAICT.

> A difficulty I have been noticing with some of these special-purpose
> contexts is that you'd like to keep a pointer to them in some global
> variable, but there's no easy way to determine whether that pointer is
> currently valid

Shouldn't it be NULL if it's not valid?


-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden



pgsql-hackers by date:

Previous
From: Tim Perdue
Date:
Subject: Article on MySQL vs. Postgres
Next
From: Peter Eisentraut
Date:
Subject: zlib for pg_dump