Re: Avoid use deprecated Windows Memory API

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Avoid use deprecated Windows Memory API
Date: 2022-09-15 08:35:34
Message-ID: 2793E149-951D-44DE-9167-232A3E41FC56@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> 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.

- 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.

--
Daniel Gustafsson https://vmware.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message velagandula sravan kumar 2022-09-15 08:52:33 Re: walmethods.c/h are doing some strange things
Previous Message Kyotaro Horiguchi 2022-09-15 08:30:11 Re: START_REPLICATION SLOT causing a crash in an assert build