From: Christopher Dykes Date: Thu, 4 Aug 2016 23:00:55 +0000 (-0700) Subject: Don't attempt to mmap an anonymous shared piece of memory X-Git-Tag: v2016.08.08.00~9 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b837180a88e62576ab8cd4b85ee67f91771d945f;p=folly.git Don't attempt to mmap an anonymous shared piece of memory Summary: The portability implementation of `mmap` for Windows doesn't currently support anonymous shared allocations, as they are non-trivial to manage, and the places this is being used doesn't actually need the memory to be allocated as shared, so allocate it as private instead. Reviewed By: yfeldblum Differential Revision: D3671495 fbshipit-source-id: e74d4fd925363fef16c1bf8445da1ff32bf8266d --- diff --git a/folly/test/AtomicHashArrayTest.cpp b/folly/test/AtomicHashArrayTest.cpp index 92be30da..9e53635e 100644 --- a/folly/test/AtomicHashArrayTest.cpp +++ b/folly/test/AtomicHashArrayTest.cpp @@ -73,7 +73,7 @@ class MmapAllocator { T *allocate(size_t n) { void *p = mmap(nullptr, n * sizeof(T), PROT_READ | PROT_WRITE, - MAP_SHARED | MAP_ANONYMOUS, -1, 0); + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (p == MAP_FAILED) throw std::bad_alloc(); return (T *)p; }