summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_test.cc
diff options
context:
space:
mode:
authorEtienne Bergeron <etienneb@google.com>2016-07-07 17:44:08 +0000
committerEtienne Bergeron <etienneb@google.com>2016-07-07 17:44:08 +0000
commit9654f2afe3e166bbdd2225eb9d5eb2c9c1b3570b (patch)
tree53d08222c2f1813948f6e16ef204d694ee74ab54 /compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_test.cc
parentedb38a94f83bf9bf6e6b1c871e81082db43ddef0 (diff)
downloadbcm5719-llvm-9654f2afe3e166bbdd2225eb9d5eb2c9c1b3570b.tar.gz
bcm5719-llvm-9654f2afe3e166bbdd2225eb9d5eb2c9c1b3570b.zip
[compiler-rt] Fix sanitizer memory allocator on win64.
Summary: This patch is fixing unittests for sanitizer memory allocator. There was two issues: 1) The VirtualAlloc can't reserve twice a memory range. The memory space used by the SizeClass allocator is reserved with NoAccess and pages are commited on demand (using MmapFixedOrDie). 2) The address space is allocated using two VirtualAlloc calls. The first one for the memory space, the second one for the AdditionnalSpace (after). On windows, they need to be freed separately. Reviewers: rnk Subscribers: llvm-commits, wang0109, kubabrecka, chrisha Differential Revision: http://reviews.llvm.org/D21900 llvm-svn: 274772
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_test.cc')
-rw-r--r--compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_test.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_test.cc b/compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_test.cc
index e51441dafc0..31eec19c363 100644
--- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_test.cc
+++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_test.cc
@@ -29,9 +29,15 @@
#if !SANITIZER_DEBUG
#if SANITIZER_CAN_USE_ALLOCATOR64
+#if SANITIZER_WINDOWS
+static const uptr kAllocatorSpace = 0x10000000000ULL;
+static const uptr kAllocatorSize = 0x10000000000ULL; // 1T.
+static const u64 kAddressSpaceSize = 1ULL << 40;
+#else
static const uptr kAllocatorSpace = 0x700000000000ULL;
static const uptr kAllocatorSize = 0x010000000000ULL; // 1T.
static const u64 kAddressSpaceSize = 1ULL << 47;
+#endif
typedef SizeClassAllocator64<
kAllocatorSpace, kAllocatorSize, 16, DefaultSizeClassMap> Allocator64;
OpenPOWER on IntegriCloud