From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Peter Geoghegan <pg@heroku.com>
Cc: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Subject: Re: memory leak in e94568ecc10 (pre-reading in external sort)
Date: Tue, 11 Oct 2016 11:45:15 +0300
Message-ID: <cdc3ccb3-496f-7ad8-f4cd-e07215f83809@iki.fi> (raw)
In-Reply-To: <CAM3SWZTAT8YxknqZ+H61hqFBU7DG8ifZwQNzebYf9JsLmrNmtA@mail.gmail.com>
References: <7303da46-daf7-9c68-3cc1-9f83235cf37e@2ndquadrant.com>
<9f997ab1-5f3a-cf79-b92b-dc170ec75043@iki.fi>
<CAM3SWZQj7r8YxYn-UVHAEc1LFsHCUQ0Z2EE3Ltb4t5nysdzuXA@mail.gmail.com>
<0f607c4b-df23-353e-bf56-c0389d28495f@iki.fi>
<CAM3SWZTAT8YxknqZ+H61hqFBU7DG8ifZwQNzebYf9JsLmrNmtA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
On 10/11/2016 12:56 AM, Peter Geoghegan wrote:
> Also, something about trace_sort here:
>
>> +#ifdef TRACE_SORT
>> + if (trace_sort)
>> + elog(LOG, "using " INT64_FORMAT " KB of memory for read buffers among %d input tapes",
>> + (state->availMem) / 1024, numInputTapes);
>> +#endif
>> +
>> + state->read_buffer_size = state->availMem / numInputTapes;
>> + USEMEM(state, state->availMem);
>
> Maybe you should just make the trace_sort output talk about blocks at
> this point?
With # of blocks, you then have to mentally divide by 8 to get the
actual memory used. I think kB is nicer in messages that are meant to be
read by humans.
The bigger problem with this message is that it's not very accurate
anymore. The actual amount of memory used is rounded down, and capped by
MaxAllocSize*numInputTapes. And would it be better to print the per-tape
buffer size, rather than the total?
- Heikki
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: hlinnaka@iki.fi, pg@heroku.com, tomas.vondra@2ndquadrant.com
Subject: Re: memory leak in e94568ecc10 (pre-reading in external sort)
In-Reply-To: <cdc3ccb3-496f-7ad8-f4cd-e07215f83809@iki.fi>
References: <7303da46-daf7-9c68-3cc1-9f83235cf37e@2ndquadrant.com> <9f997ab1-5f3a-cf79-b92b-dc170ec75043@iki.fi> <CAM3SWZQj7r8YxYn-UVHAEc1LFsHCUQ0Z2EE3Ltb4t5nysdzuXA@mail.gmail.com> <0f607c4b-df23-353e-bf56-c0389d28495f@iki.fi> <CAM3SWZTAT8YxknqZ+H61hqFBU7DG8ifZwQNzebYf9JsLmrNmtA@mail.gmail.com> <cdc3ccb3-496f-7ad8-f4cd-e07215f83809@iki.fi>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox