Commit ea0b6044 authored by Eli Zaretskii's avatar Eli Zaretskii

Fix memory reservation on MS-Windows

* src/w32heap.c (mmap_alloc): Reserve memory in 64KB granular
units.  This avoids leaving gaps in reserved memory regions that
no one can use, since memory reservation must produce 64KB-aligned
addresses.  (Bug#22526)
parent c5f72aa5
......@@ -641,12 +641,14 @@ mmap_alloc (void **var, size_t nbytes)
advance, and the buffer is enlarged several times as the data is
decompressed on the fly. */
if (nbytes < MAX_BUFFER_SIZE)
p = VirtualAlloc (NULL, (nbytes * 2), MEM_RESERVE, PAGE_READWRITE);
p = VirtualAlloc (NULL, ROUND_UP (nbytes * 2, get_allocation_unit ()),
/* If it fails, or if the request is above 512MB, try with the
requested size. */
if (p == NULL)
p = VirtualAlloc (NULL, nbytes, MEM_RESERVE, PAGE_READWRITE);
p = VirtualAlloc (NULL, ROUND_UP (nbytes, get_allocation_unit ()),
if (p != NULL)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment