From f5974c88451783d4c1fb69444b10d7053be142bf Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Fri, 30 Oct 2015 20:48:53 +0100 Subject: 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 --- rts/win32/OSMem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'rts/win32') 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); } -- cgit v1.2.1