diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2012-08-24 15:53:14 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2012-08-24 15:53:14 +0000 |
commit | ae46cd0e92794f3b18f49f94c081e414fb7e1367 (patch) | |
tree | 5324f5ce096e8e25571acb07cf732e3fd41caecc /lib | |
parent | f5b925fde9c855eab4fbc71354e79cc777ed19ec (diff) | |
download | compiler-rt-ae46cd0e92794f3b18f49f94c081e414fb7e1367.tar.gz compiler-rt-ae46cd0e92794f3b18f49f94c081e414fb7e1367.tar.bz2 compiler-rt-ae46cd0e92794f3b18f49f94c081e414fb7e1367.tar.xz |
tsan: improve memory allocator a bit
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@162561 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sanitizer_common/sanitizer_allocator64.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/sanitizer_common/sanitizer_allocator64.h b/lib/sanitizer_common/sanitizer_allocator64.h index 68a52a3d..2e12afd4 100644 --- a/lib/sanitizer_common/sanitizer_allocator64.h +++ b/lib/sanitizer_common/sanitizer_allocator64.h @@ -147,11 +147,15 @@ class SizeClassAllocator64 { PopulateFreeList(class_id, region); } CHECK(!region->free_list.empty()); - const uptr count = SizeClassMap::MaxCached(class_id); - for (uptr i = 0; i < count && !region->free_list.empty(); i++) { - AllocatorListNode *node = region->free_list.front(); - region->free_list.pop_front(); - free_list->push_front(node); + uptr count = SizeClassMap::MaxCached(class_id); + if (region->free_list.size() <= count) { + free_list->append_front(®ion->free_list); + } else { + for (uptr i = 0; i < count; i++) { + AllocatorListNode *node = region->free_list.front(); + region->free_list.pop_front(); + free_list->push_front(node); + } } CHECK(!free_list->empty()); } |