Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bKyPH-00041D-WD for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Jul 2016 01:47:12 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bKyPH-0007lq-JJ for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Jul 2016 01:47:11 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bKyNu-0004Q1-FO for pgsql-hackers@postgresql.org; Thu, 07 Jul 2016 01:45:46 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bKyNn-0004AG-P2 for pgsql-hackers@postgresql.org; Thu, 07 Jul 2016 01:45:45 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u671ja0V020286; Wed, 6 Jul 2016 21:45:36 -0400 From: Tom Lane To: Greg Stark cc: Robert Haas , PostgreSQL-development Subject: Re: can we optimize STACK_DEPTH_SLOP In-reply-to: References: <32729.1467734050@sss.pgh.pa.us> <28549.1467748100@sss.pgh.pa.us> <19108.1467812089@sss.pgh.pa.us> Comments: In-reply-to Greg Stark message dated "Thu, 07 Jul 2016 01:01:11 +0100" Date: Wed, 06 Jul 2016 21:45:36 -0400 Message-ID: <20280.1467855936@sss.pgh.pa.us> X-Pg-Spam-Score: -3.2 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Greg Stark 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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers