Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aftuZ-0007F7-FC for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Mar 2016 18:41:43 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1aftuZ-0005yf-1r for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Mar 2016 18:41:43 +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 1aftuX-0005wK-DN for pgsql-hackers@postgresql.org; Tue, 15 Mar 2016 18:41:41 +0000 Received: from linode.thelabyrinth.net ([198.58.117.137] helo=mail.thelabyrinth.net) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1aftuU-00014c-Na for pgsql-hackers@postgresql.org; Tue, 15 Mar 2016 18:41:40 +0000 Received: from desktop.home.thelabyrinth.net (unknown [98.204.177.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dsteele) by mail.thelabyrinth.net (Postfix) with ESMTPSA id C54E112D13; Tue, 15 Mar 2016 18:41:37 +0000 (UTC) Subject: Re: pgbench stats per script & other stuff References: <20160304184157.GA726930@alvherre.pgsql> Cc: Fabien COELHO , Michael Paquier , "pgsql-hackers@postgresql.org" To: Alvaro Herrera From: David Steele Message-ID: <56E85761.3030105@pgmasters.net> Date: Tue, 15 Mar 2016 14:41:37 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -1.9 (-) 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 On 3/4/16 1:53 PM, Fabien COELHO wrote: >>> That is why the "fs" variable in process_file is declared "static", >>> and why >>> I wrote "some hidden awkwarness". >>> >>> I did want to avoid a malloc because then who would free the struct? >>> addScript cannot to it systematically because builtins are static. Or it >>> would have to create an on purpose struct, but I then that would be more >>> awkwarness, and malloc/free to pass arguments between functions is not >>> efficient nor very elegant. >>> >>> So the "static" option looked like the simplest & most elegant version. >> >> Surely that trick breaks if you have more than one -f switch, no? Oh, I >> see what you're doing: you only use the command list, which is >> allocated, so it doesn't matter that the rest of the struct changes >> later. > > The two fields that matter (desc and commands) are really copied into > sql_scripts, so what stays in the is overriden if used another time. > >> I'm not concerned about freeing the struct; what's the problem with it >> surviving until the program terminates? > > It is not referenced anywhere so it is a memory leak. > >> If somebody specifies thousands of -f switches, they will waste a few >> bytes with each, but I'm hardly concerned about a few dozen kilobytes >> there ... > > Ok, so you prefer a memory leak. I hate it on principle. > > Here is a v23 with a memory leak anyway. Álvaro, it looks like you've been both reviewer and committer on this work for some time. The latest patch seems to address you final concern. Can I mark it "ready for committer"? -- -David david@pgmasters.net -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers