[Git][ghc/ghc][master] rts: Allocate MBlocks with MAP_TOP_DOWN on Windows
Marge Bot
gitlab at gitlab.haskell.org
Fri Nov 27 11:20:48 UTC 2020
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
a1a75aa9 by Ben Gamari at 2020-11-27T06:20:41-05:00
rts: Allocate MBlocks with MAP_TOP_DOWN on Windows
As noted in #18991, we would previously allocate heap in low memory.
Due to this the linker, which typically *needs* low memory, would end up
competing with the heap. In longer builds we end up running out of
low memory entirely, leading to linking failures.
- - - - -
1 changed file:
- rts/win32/OSMem.c
Changes:
=====================================
rts/win32/OSMem.c
=====================================
@@ -50,8 +50,11 @@ allocNew(uint32_t n) {
alloc_rec* rec;
rec = (alloc_rec*)stgMallocBytes(sizeof(alloc_rec),"getMBlocks: allocNew");
rec->size = ((W_)n+1)*MBLOCK_SIZE;
+ // N.B. We use MEM_TOP_DOWN here to ensure that we leave the bottom of the
+ // address space available for the linker and libraries, which in general
+ // want to live in low memory. See #18991.
rec->base =
- VirtualAlloc(NULL, rec->size, MEM_RESERVE, PAGE_READWRITE);
+ VirtualAlloc(NULL, rec->size, MEM_RESERVE | MEM_TOP_DOWN, PAGE_READWRITE);
if(rec->base==0) {
stgFree((void*)rec);
rec=0;
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a1a75aa9be2c133dd1372a08eeb6a92c31688df7
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a1a75aa9be2c133dd1372a08eeb6a92c31688df7
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20201127/762bcdd9/attachment-0001.html>
More information about the ghc-commits
mailing list