summaryrefslogtreecommitdiff
path: root/rts/win32/OSMem.c
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2015-10-30 20:48:53 +0100
committerBen Gamari <ben@smart-cactus.org>2015-10-30 23:35:50 +0100
commitf5974c88451783d4c1fb69444b10d7053be142bf (patch)
treeebe7ad0175ff6e848241f8f4b45150431b32bfbb /rts/win32/OSMem.c
parent39b71e81ec1044518f065d0055676d713521e483 (diff)
downloadhaskell-f5974c88451783d4c1fb69444b10d7053be142bf.tar.gz
rts: Make MBLOCK_SPACE_SIZE dynamic
Previously this was introduced in D524 as a compile-time constant. Sadly, this isn't flexible enough to allow for environments where ulimits restrict the maximum address space size (see, for instance, Consequently, we are forced to make this dynamic. In principle this shouldn't be so terrible as we can place both the beginning and end addresses within the same cache line, likely incurring only one or so additional instruction in HEAP_ALLOCED. Test Plan: validate Reviewers: austin, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1353 GHC Trac Issues: #10877
Diffstat (limited to 'rts/win32/OSMem.c')
-rw-r--r--rts/win32/OSMem.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/rts/win32/OSMem.c b/rts/win32/OSMem.c
index 716171b3fc..2d2af0ddf6 100644
--- a/rts/win32/OSMem.c
+++ b/rts/win32/OSMem.c
@@ -429,11 +429,11 @@ void setExecutable (void *p, W_ len, rtsBool exec)
static void* heap_base = NULL;
-void *osReserveHeapMemory (void)
+void *osReserveHeapMemory (W_ len)
{
void *start;
- heap_base = VirtualAlloc(NULL, MBLOCK_SPACE_SIZE + MBLOCK_SIZE,
+ heap_base = VirtualAlloc(NULL, len + MBLOCK_SIZE,
MEM_RESERVE, PAGE_READWRITE);
if (heap_base == NULL) {
if (GetLastError() == ERROR_NOT_ENOUGH_MEMORY) {
@@ -441,7 +441,7 @@ void *osReserveHeapMemory (void)
} else {
sysErrorBelch(
"osReserveHeapMemory: VirtualAlloc MEM_RESERVE %llu bytes failed",
- MBLOCK_SPACE_SIZE + MBLOCK_SIZE);
+ len + MBLOCK_SIZE);
}
stg_exit(EXIT_FAILURE);
}