Re: patch: tsearch - some memory diet - Mailing list pgsql-hackers

From Tom Lane
Subject Re: patch: tsearch - some memory diet
Date
Msg-id 19405.1286386827@sss.pgh.pa.us
Whole thread Raw
In response to Re: patch: tsearch - some memory diet  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: patch: tsearch - some memory diet  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> I think it would be cleaner to get rid of checkTmpCtx() and instead
> have dispell_init() set up and tear down the temporary context,

What I was thinking of doing was getting rid of the static variable
altogether: we should do what you say above, but in the form of a
state struct that's created and destroyed by additional calls from
dispell_init().  Then that state struct could also carry the
infrastructure for this additional hack.  It's a little more notation to
pass an additional parameter through all these routines, but from the
standpoint of understandability and maintainability it's clearly worth
it.

> void NISetupForDictionaryLoad();
> void NICleanupAfterDictionaryLoad();

More like
NISpellState *NISpellInit();NISpellTerm(NISpellState *stat);

> ...but I don't really see why that has to be done as part of this patch.

Because patches that reduce maintainability seldom get cleaned up after.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Bug / shortcoming in has_*_privilege
Next
From: Robert Haas
Date:
Subject: Re: patch: tsearch - some memory diet