Re: can we optimize STACK_DEPTH_SLOP

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: can we optimize STACK_DEPTH_SLOP
Дата
Msg-id 20280.1467855936@sss.pgh.pa.us
обсуждение исходный текст
Ответ на can we optimize STACK_DEPTH_SLOP  (Greg Stark <stark@mit.edu>)
Ответы Re: can we optimize STACK_DEPTH_SLOP  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Greg Stark <stark@mit.edu> writes:
> Ok, I managed to get __atribute__((destructor)) working and capitured
> the attached pmap output for all the revisions. You can see the git
> revision in the binary name along with a putative date though in the
> case of branches the date can be deceptive. It looks to me like REL8_4
> is already bloated by REL8_4_0~2268 (which means 2268 commits *before*
> the REL8_4_0 tag -- i.e. soon after it branched).

I traced through this by dint of inserting a lot of system("pmap") calls,
and what I found out is that it's the act of setting one of the timezone
variables that does it.  This is because tzload() allocates a local
variable "union local_storage ls", which sounds harmless enough, but
in point of fact the darn thing is 78K!  And to add insult to injury,
with my setting (US/Eastern) there is a recursive call to parse the
"posixrules" timezone file.  So that's 150K worth of stack right
there, although possibly it's only half that for some zone settings.
(And if you use "GMT" you escape all of this, since that's hard coded.)

So now I understand why the IANA code has provisions for malloc'ing
that storage rather than just using the stack.  We should do likewise.
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: dumping database privileges broken in 9.6
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: [PATCH] Set sgml-basic-offset to 1 in .dir-locals.el