summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2012-08-24 15:53:14 +0000
committerDmitry Vyukov <dvyukov@google.com>2012-08-24 15:53:14 +0000
commit7d3d94454c423046d3ce00052b74ed0d722b2518 (patch)
tree876a3a9e5bce0fd08a1160a0acde8e4ce2e601b8
parentab24b6e24e5a2bea7ee5bfd09930060e994841c7 (diff)
downloadbcm5719-llvm-7d3d94454c423046d3ce00052b74ed0d722b2518.tar.gz
bcm5719-llvm-7d3d94454c423046d3ce00052b74ed0d722b2518.zip
tsan: improve memory allocator a bit
llvm-svn: 162561
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_allocator64.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator64.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator64.h
index 68a52a3d53a..2e12afd4c44 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator64.h
+++ b/compiler-rt/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(&region->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());
}
OpenPOWER on IntegriCloud