From 42f8cddf404b99c32ec2cf09e7d4a943f2750bc0 Mon Sep 17 00:00:00 2001 From: Sam Goldman Date: Sat, 28 Dec 2019 11:39:05 -0800 Subject: [PATCH] Fix Windows build Summary: I broke this in D19183602. I reversed the calculation being performed here, to instead include the size of the objects we do want to reserve. Separately, it seems like a reasonable idea to commit these pages all the time, not just for Windows. Differential Revision: D19239503 fbshipit-source-id: e5066227d3c0206af6e2b37331914b9f7eade29d --- src/heap/hh_shared.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/heap/hh_shared.c b/src/heap/hh_shared.c index dcea8563ec9..be410fb3dac 100644 --- a/src/heap/hh_shared.c +++ b/src/heap/hh_shared.c @@ -714,8 +714,8 @@ static void define_globals(char * shared_mem_init) { assert (CACHE_LINE_SIZE >= sizeof(size_t)); wasted_heap_size = (size_t*)(mem + 6*CACHE_LINE_SIZE); - assert (CACHE_LINE_SIZE >= sizeof(size_t)); - hcounter_filled = (size_t*)(mem + 7*CACHE_LINE_SIZE); + assert (CACHE_LINE_SIZE >= sizeof(uint64_t)); + hcounter_filled = (uint64_t*)(mem + 7*CACHE_LINE_SIZE); mem += page_size; // Just checking that the page is large enough. @@ -739,7 +739,7 @@ static void define_globals(char * shared_mem_init) { /* Reserve all memory space. This is required for Windows but we don't do this * for Linux since it lets us run more processes in parallel without running * out of memory immediately (though we do risk it later on) */ - memfd_reserve((char *)heap, heap_init - (char *)heap); + memfd_reserve((char *)heap, page_size + locals_size_b + hashtbl_size_b); #endif }