Closed GoogleCodeExporter closed 9 years ago
The 'large alloc' warnings are coming because 'static int64_t
large_alloc_threshold'
(tcmalloc.cc) is == 0 at the time these mallocs are occuring, which is during
static
initialization time before main.
Specifically, the gflags DEFINE_string() in various files in tcmalloc causes
STL to
initialize a pool for basic_string, which triggers the mallocs. For me, the
mallocs() during static-init-time tend to be either 36864 (9 pages) or 65536
(16 pages).
I propose this patch -- the extra (and well predictable) branch shouldn't affect
performance in a function that already needs to get more pages, I'd imagine.
--- /home/mrabkin/gperftools/google-perftools-1.1/src/tcmalloc.cc 2009-03-03
11:52:18.000000000 -0800
+++ tcmalloc.cc 2009-03-30 11:25:29.085659000 -0700
@@ -598,7 +598,7 @@
SpinLockHolder h(Static::pageheap_lock());
span = Static::pageheap()->New(num_pages);
const int64 threshold = large_alloc_threshold;
- if (num_pages >= (threshold >> kPageShift)) {
+ if (threshold && num_pages >= (threshold >> kPageShift)) {
// Increase the threshold by 1/8 every time we generate a report.
// We cap the threshold at 8GB to avoid overflow problems.
large_alloc_threshold = (threshold + threshold/8 < 8ll<<30
Original comment by mrab...@gmail.com
on 30 Mar 2009 at 6:26
I like both fixes. They'll be in the next tcmalloc release.
Original comment by csilv...@gmail.com
on 30 Mar 2009 at 11:11
Original comment by csilv...@gmail.com
on 30 Mar 2009 at 11:19
This should be fixed in perftools 1.2, just released. I also threw in a fix for
cygwin, which had tricky issues involving the .exe extension.
Original comment by csilv...@gmail.com
on 18 Apr 2009 at 12:12
Original issue reported on code.google.com by
mrab...@gmail.com
on 29 Mar 2009 at 7:12