[asan] make the __asan_get_heap_size more robust
authorKostya Serebryany <kcc@google.com>
Mon, 18 Mar 2013 10:52:25 +0000 (10:52 +0000)
committerKostya Serebryany <kcc@google.com>
Mon, 18 Mar 2013 10:52:25 +0000 (10:52 +0000)
llvm-svn: 177270

compiler-rt/lib/asan/tests/asan_noinst_test.cc

index 1be41db..1681842 100644 (file)
@@ -464,6 +464,7 @@ TEST(AddressSanitizerInterface, GetHeapSizeTest) {
   // The chunk should be greater than the quarantine size,
   // otherwise it will be stuck in quarantine instead of being unmaped.
   static const size_t kLargeMallocSize = (1 << 28) + 1;  // 256M
+  free(Ident(malloc(kLargeMallocSize)));  // Drain quarantine.
   uptr old_heap_size = __asan_get_heap_size();
   for (int i = 0; i < 3; i++) {
     // fprintf(stderr, "allocating %zu bytes:\n", kLargeMallocSize);