emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-25 ea0b604: Fix memory reservation on MS-Windows


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-25 ea0b604: Fix memory reservation on MS-Windows
Date: Sat, 20 Feb 2016 17:01:21 +0000

branch: emacs-25
commit ea0b604412d6b33353839640f7d5e5e0b62a45ad
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    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)
---
 src/w32heap.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/w32heap.c b/src/w32heap.c
index 69706a3..b908169 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -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)
     {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]