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)
This commit is contained in:
parent
c5f72aa573
commit
ea0b604412
1 changed files with 4 additions and 2 deletions
|
@ -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 ()),
|
||||
MEM_RESERVE, PAGE_READWRITE);
|
||||
|
||||
/* 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 ()),
|
||||
MEM_RESERVE, PAGE_READWRITE);
|
||||
|
||||
if (p != NULL)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue