Re: Avoid use deprecated Windows Memory API

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Avoid use deprecated Windows Memory API
Date: 2022-09-15 11:26:34
Message-ID: CAEudQAq18WuwSSvwqEru=NFXiYW8jwopYRmhJOOup39+-QQsFg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em qui., 15 de set. de 2022 às 05:35, Daniel Gustafsson <daniel(at)yesql(dot)se>
escreveu:

> > On 15 Sep 2022, at 01:19, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:
>
> > LocalAlloc is deprecated.
> > So use HeapAlloc instead, once LocalAlloc is an overhead wrapper to
> HeapAlloc.
> >
> > Attached a patch.
>
> Don't forget that patches which aim to reduce overhead are best when
> accompanied with benchmarks which show the effect of the reduction.
>
I'm trusting the API producer.

>
> - pacl = (PACL) LocalAlloc(LPTR, dwNewAclSize);
> + pacl = (PACL) HeapAlloc(hDefaultProcessHeap, 0, dwNewAclSize);
>
> These calls are not equal, the LocalAlloc calls zeroes out the allocated
> memory
> but the HeapAlloc does not unless the HEAP_ZERO_MEMORY flag is passed. I
> haven't read the code enough to know if that matters, but it seems
> relevant to
> at least discuss.
>
Yeah, I missed that.
But works fine and passes all tests.
If really ok, yet another improvement by avoiding useless padding.

CF entry created.
https://commitfest.postgresql.org/40/3893/

regards,
Ranier Vilela

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Japin Li 2022-09-15 11:36:40 Re: SUBTRANS: Minimizing calls to SubTransSetParent()
Previous Message Bharath Rupireddy 2022-09-15 10:25:54 Re: Assertion failure in WaitForWALToBecomeAvailable state machine