Re: Typo in bufmgr.c that result in waste of memory

From: Takashi Horikawa <t-horikawa(at)aj(dot)jp(dot)nec(dot)com>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Typo in bufmgr.c that result in waste of memory
Date: 2016-02-19 09:48:34
Message-ID: 73FA3881462C614096F815F75628AFCD035A4AC5@BPXM01GP.gisp.nec.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> I see the problem, but I don't buy the argument that it wastes large amounts
> of memory. Or do you have some evidence that it does?
No. I don’t have any trouble caused by it.
I think I did not mention it wastes 'large' amount of memory but 'a few'.

> I think we should fix it, but not backpatch.
I agree that backpatch is unnecessary.
I hope it will be fixed for the current development version
at some suitable opportunity.

Best regards,
Takashi Horikawa
NEC Corporation
Knowledge Discovery Research Laboratories

> -----Original Message-----
> From: pgsql-hackers-owner(at)postgresql(dot)org
> [mailto:pgsql-hackers-owner(at)postgresql(dot)org] On Behalf Of Simon Riggs
> Sent: Friday, February 19, 2016 6:24 PM
> To: Horikawa Takashi(堀川 隆)
> Cc: PostgreSQL Hackers
> Subject: Re: [HACKERS] Typo in bufmgr.c that result in waste of memory
>
> On 19 February 2016 at 02:58, Takashi Horikawa <t-horikawa(at)aj(dot)jp(dot)nec(dot)com>
> wrote:
>
>
>
> I have just found a typo in the source code (not in a comment) of
> bufmgr.c
> that result in waste of memory. It might be a 'bug' but it does
> not result
> in any incorrect operation but just results in waste of a few memory
> resource.
>
> As sizeof(PrivateRefCountArray) found in InitBufferPoolAccess()
> is 64 and
> sizeof(PrivateRefCountEntry) which should be used here is 8, this
> typo
> produces 56 byte of unused memory area per one PrivateRefCount entry
> in the
> hash table. I think this result in not only the waste of memory
> but also
> reduces the cache hit ratio.
>
> X hash_ctl.entrysize = sizeof(PrivateRefCountArray);
> O hash_ctl.entrysize = sizeof(PrivateRefCountEntry);
>
>
>
> I see the problem, but I don't buy the argument that it wastes large amounts
> of memory. Or do you have some evidence that it does?
>
> I think we should fix it, but not backpatch.
>
> --
>
> Simon Riggs http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2016-02-19 11:07:26 Re: proposal: function parse_ident
Previous Message Artur Zakirov 2016-02-19 09:41:43 Re: plpgsql - DECLARE - cannot to use %TYPE or %ROWTYPE for composite types