Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1177)

Unified Diff: base/trace_event/heap_profiler_allocation_register.h

Issue 2587823004: Increase allocation register capacity for desktop platforms (Closed)
Patch Set: Fix bucket size and hashing. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/trace_event/heap_profiler_allocation_register.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/heap_profiler_allocation_register.h
diff --git a/base/trace_event/heap_profiler_allocation_register.h b/base/trace_event/heap_profiler_allocation_register.h
index 873aebfc0cb3ca7a491ecc4a4a0e633bc70b5823..d6a02faeaeaacca487e3ff13d7f71dac34768da1 100644
--- a/base/trace_event/heap_profiler_allocation_register.h
+++ b/base/trace_event/heap_profiler_allocation_register.h
@@ -16,6 +16,7 @@
#include "base/process/process_metrics.h"
#include "base/template_util.h"
#include "base/trace_event/heap_profiler_allocation_context.h"
+#include "build/build_config.h"
namespace base {
namespace trace_event {
@@ -198,7 +199,9 @@ class FixedHashMap {
// the simplest solution is to just allocate a humongous chunk of address
// space.
- DCHECK_LT(next_unused_cell_, num_cells_ + 1);
+ CHECK_LT(next_unused_cell_, num_cells_ + 1)
+ << "Allocation Register hash table has too little capacity. Increase "
+ "the capacity to run heap profiler in large sessions.";
return &cells_[idx];
}
@@ -299,10 +302,16 @@ class BASE_EXPORT AllocationRegister {
private:
friend AllocationRegisterTest;
- // Expect max 1.5M allocations. Number of buckets is 2^18 for optimal
- // hashing and should be changed together with AddressHasher.
+// Expect lower number of allocations from mobile platforms. Load factor
+// (capacity / bucket count) is kept less than 10 for optimal hashing. The
+// number of buckets should be changed together with AddressHasher.
+#if defined(OS_ANDROID) || defined(OS_IOS)
static const size_t kAllocationBuckets = 1 << 18;
static const size_t kAllocationCapacity = 1500000;
+#else
+ static const size_t kAllocationBuckets = 1 << 19;
+ static const size_t kAllocationCapacity = 5000000;
+#endif
// 2^16 works well with BacktraceHasher. When increasing this number make
// sure BacktraceHasher still produces low number of collisions.
« no previous file with comments | « no previous file | base/trace_event/heap_profiler_allocation_register.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698