[llvm-commits] [compiler-rt] r162561 - /compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator64.h

Dmitry Vyukov dvyukov at google.com
Fri Aug 24 08:53:15 PDT 2012


Author: dvyukov
Date: Fri Aug 24 10:53:14 2012
New Revision: 162561

URL: http://llvm.org/viewvc/llvm-project?rev=162561&view=rev
Log:
tsan: improve memory allocator a bit

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator64.h

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator64.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator64.h?rev=162561&r1=162560&r2=162561&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator64.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator64.h Fri Aug 24 10:53:14 2012
@@ -147,11 +147,15 @@
       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());
   }





More information about the llvm-commits mailing list