Skip to content

Commit 2c01237

Browse files
committed
SERVER-13544 Enable gperftools for C++11 builds
The following change was backported: https://code.google.com/p/gperftools/source/detail?r=18fbc316eebea9db2d7ec41e161c0a3fbb09fa42 Another change we wanted was: https://code.google.com/p/gperftools/source/detail?r=6287bbbbad8730712cfd1ee28ecc0648cbaa9f94# However, since that patch must hit every PR/SC instance and the code has evolved from that point we instead just ran the following two scripts over the gperftools source tree: find . -type f | xargs egrep -l '"PR\w+"' | xargs perl -pi -e 's|"PR(\w+)"|" PR\1 "|g' find . -type f | xargs egrep -l '"SC\w+"' | xargs perl -pi -e 's|"SC(\w+)"|" SC\1 "|g' and then manually fixing up the one reference to GPRIuPTHREAD, which achieved the same result. Finally, remove the logic preventing mixture of C++11 and gperftools from the build system.
1 parent 9ca0f44 commit 2c01237

File tree

13 files changed

+65
-72
lines changed

13 files changed

+65
-72
lines changed

SConstruct

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,13 +1163,6 @@ def doConfigure(myenv):
11631163
if not AddToCXXFLAGSIfSupported(myenv, '-std=c++0x'):
11641164
print( 'C++11 mode requested, but cannot find a flag to enable it' )
11651165
Exit(1)
1166-
# Our current builtin tcmalloc is not compilable in C++11 mode. Remove this
1167-
# check when our builtin release of tcmalloc contains the resolution to
1168-
# http://code.google.com/p/gperftools/issues/detail?id=477.
1169-
if get_option('allocator') == 'tcmalloc':
1170-
if not use_system_version_of_library('tcmalloc'):
1171-
print( 'TCMalloc is not currently compatible with C++11' )
1172-
Exit(1)
11731166

11741167
if not AddToCFLAGSIfSupported(myenv, '-std=c99'):
11751168
print( 'C++11 mode selected for C++ files, but failed to enable C99 for C files' )

src/third_party/gperftools-2.0/src/base/sysinfo.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ bool ProcMapsIterator::NextExt(uint64 *start, uint64 *end, char **flags,
712712
unsigned filename_offset = 0;
713713
#if defined(__linux__)
714714
// for now, assume all linuxes have the same format
715-
if (sscanf(stext_, "%"SCNx64"-%"SCNx64" %4s %"SCNx64" %x:%x %"SCNd64" %n",
715+
if (sscanf(stext_, "%" SCNx64 "-%" SCNx64 " %4s %" SCNx64 " %x:%x %" SCNd64 " %n",
716716
start ? start : &tmpstart,
717717
end ? end : &tmpend,
718718
flags_,
@@ -749,7 +749,7 @@ bool ProcMapsIterator::NextExt(uint64 *start, uint64 *end, char **flags,
749749
// start end resident privateresident obj(?) prot refcnt shadowcnt
750750
// flags copy_on_write needs_copy type filename:
751751
// 0x8048000 0x804a000 2 0 0xc104ce70 r-x 1 0 0x0 COW NC vnode /bin/cat
752-
if (sscanf(stext_, "0x%"SCNx64" 0x%"SCNx64" %*d %*d %*p %3s %*d %*d 0x%*x %*s %*s %*s %n",
752+
if (sscanf(stext_, "0x%" SCNx64 " 0x%" SCNx64 " %*d %*d %*p %3s %*d %*d 0x%*x %*s %*s %*s %n",
753753
start ? start : &tmpstart,
754754
end ? end : &tmpend,
755755
flags_,
@@ -786,7 +786,7 @@ bool ProcMapsIterator::NextExt(uint64 *start, uint64 *end, char **flags,
786786
uint64 tmp_anon_mapping;
787787
uint64 tmp_anon_pages;
788788

789-
sscanf(backing_ptr+1, "F %"SCNx64" %"SCNd64") (A %"SCNx64" %"SCNd64")",
789+
sscanf(backing_ptr+1, "F %" SCNx64 " %" SCNd64 ") (A %" SCNx64 " %" SCNd64 ")",
790790
file_mapping ? file_mapping : &tmp_file_mapping,
791791
file_pages ? file_pages : &tmp_file_pages,
792792
anon_mapping ? anon_mapping : &tmp_anon_mapping,
@@ -926,7 +926,7 @@ int ProcMapsIterator::FormatLine(char* buffer, int bufsize,
926926
? '-' : 'p';
927927

928928
const int rc = snprintf(buffer, bufsize,
929-
"%08"PRIx64"-%08"PRIx64" %c%c%c%c %08"PRIx64" %02x:%02x %-11"PRId64" %s\n",
929+
"%08" PRIx64 "-%08" PRIx64 " %c%c%c%c %08" PRIx64 " %02x:%02x %-11" PRId64 " %s\n",
930930
start, end, r,w,x,p, offset,
931931
static_cast<int>(dev/256), static_cast<int>(dev%256),
932932
inode, filename);

src/third_party/gperftools-2.0/src/debugallocation.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ class MallocBlock {
488488
// the address space could take more.
489489
static size_t max_size_t = ~0;
490490
if (size > max_size_t - sizeof(MallocBlock)) {
491-
RAW_LOG(ERROR, "Massive size passed to malloc: %"PRIuS"", size);
491+
RAW_LOG(ERROR, "Massive size passed to malloc: %" PRIuS "", size);
492492
return NULL;
493493
}
494494
MallocBlock* b = NULL;
@@ -958,7 +958,7 @@ static SpinLock malloc_trace_lock(SpinLock::LINKER_INITIALIZED);
958958
do { \
959959
if (FLAGS_malloctrace) { \
960960
SpinLockHolder l(&malloc_trace_lock); \
961-
TracePrintf(TraceFd(), "%s\t%"PRIuS"\t%p\t%"GPRIuPTHREAD, \
961+
TracePrintf(TraceFd(), "%s\t%" PRIuS "\t%p\t%" GPRIuPTHREAD, \
962962
name, size, addr, PRINTABLE_PTHREAD(pthread_self())); \
963963
TraceStack(); \
964964
TracePrintf(TraceFd(), "\n"); \
@@ -1223,7 +1223,7 @@ extern "C" PERFTOOLS_DLL_DECL void* tc_new(size_t size) {
12231223
void* ptr = debug_cpp_alloc(size, MallocBlock::kNewType, false);
12241224
MallocHook::InvokeNewHook(ptr, size);
12251225
if (ptr == NULL) {
1226-
RAW_LOG(FATAL, "Unable to allocate %"PRIuS" bytes: new failed.", size);
1226+
RAW_LOG(FATAL, "Unable to allocate %" PRIuS " bytes: new failed.", size);
12271227
}
12281228
return ptr;
12291229
}
@@ -1250,7 +1250,7 @@ extern "C" PERFTOOLS_DLL_DECL void* tc_newarray(size_t size) {
12501250
void* ptr = debug_cpp_alloc(size, MallocBlock::kArrayNewType, false);
12511251
MallocHook::InvokeNewHook(ptr, size);
12521252
if (ptr == NULL) {
1253-
RAW_LOG(FATAL, "Unable to allocate %"PRIuS" bytes: new[] failed.", size);
1253+
RAW_LOG(FATAL, "Unable to allocate %" PRIuS " bytes: new[] failed.", size);
12541254
}
12551255
return ptr;
12561256
}

src/third_party/gperftools-2.0/src/heap-checker.cc

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ static void NewHook(const void* ptr, size_t size) {
587587
}
588588
}
589589
}
590-
RAW_VLOG(17, "Alloc Recorded: %p of %"PRIuS"", ptr, size);
590+
RAW_VLOG(17, "Alloc Recorded: %p of %" PRIuS "", ptr, size);
591591
}
592592
}
593593

@@ -645,12 +645,12 @@ static void RegisterStackLocked(const void* top_ptr) {
645645
if (MemoryRegionMap::FindAndMarkStackRegion(top, &region)) {
646646
// Make the proper portion of the stack live:
647647
if (stack_direction == GROWS_TOWARDS_LOW_ADDRESSES) {
648-
RAW_VLOG(11, "Live stack at %p of %"PRIuPTR" bytes",
648+
RAW_VLOG(11, "Live stack at %p of %" PRIuPTR " bytes",
649649
top_ptr, region.end_addr - top);
650650
live_objects->push_back(AllocObject(top_ptr, region.end_addr - top,
651651
THREAD_DATA));
652652
} else { // GROWS_TOWARDS_HIGH_ADDRESSES
653-
RAW_VLOG(11, "Live stack at %p of %"PRIuPTR" bytes",
653+
RAW_VLOG(11, "Live stack at %p of %" PRIuPTR " bytes",
654654
AsPtr(region.start_addr),
655655
top - region.start_addr);
656656
live_objects->push_back(AllocObject(AsPtr(region.start_addr),
@@ -692,12 +692,12 @@ static void RegisterStackLocked(const void* top_ptr) {
692692
}
693693
// Make the proper portion of the stack live:
694694
if (stack_direction == GROWS_TOWARDS_LOW_ADDRESSES) {
695-
RAW_VLOG(11, "Live stack at %p of %"PRIuPTR" bytes",
695+
RAW_VLOG(11, "Live stack at %p of %" PRIuPTR " bytes",
696696
top_ptr, stack_end - top);
697697
live_objects->push_back(
698698
AllocObject(top_ptr, stack_end - top, THREAD_DATA));
699699
} else { // GROWS_TOWARDS_HIGH_ADDRESSES
700-
RAW_VLOG(11, "Live stack at %p of %"PRIuPTR" bytes",
700+
RAW_VLOG(11, "Live stack at %p of %" PRIuPTR " bytes",
701701
AsPtr(stack_start), top - stack_start);
702702
live_objects->push_back(
703703
AllocObject(AsPtr(stack_start), top - stack_start, THREAD_DATA));
@@ -770,14 +770,14 @@ static void MakeDisabledLiveCallbackLocked(
770770
// and the rest of the region where the stack lives can well
771771
// contain outdated stack variables which are not live anymore,
772772
// hence should not be treated as such.
773-
RAW_VLOG(11, "Not %s-disabling %"PRIuS" bytes at %p"
773+
RAW_VLOG(11, "Not %s-disabling %" PRIuS " bytes at %p"
774774
": have stack inside: %p",
775775
(stack_disable ? "stack" : "range"),
776776
info.object_size, ptr, AsPtr(*iter));
777777
return;
778778
}
779779
}
780-
RAW_VLOG(11, "%s-disabling %"PRIuS" bytes at %p",
780+
RAW_VLOG(11, "%s-disabling %" PRIuS " bytes at %p",
781781
(stack_disable ? "Stack" : "Range"), info.object_size, ptr);
782782
live_objects->push_back(AllocObject(ptr, info.object_size,
783783
MUST_BE_ON_HEAP));
@@ -1061,7 +1061,7 @@ static enum {
10611061
if (thread_registers.size()) {
10621062
// Make thread registers be live heap data sources.
10631063
// we rely here on the fact that vector is in one memory chunk:
1064-
RAW_VLOG(11, "Live registers at %p of %"PRIuS" bytes",
1064+
RAW_VLOG(11, "Live registers at %p of %" PRIuS " bytes",
10651065
&thread_registers[0], thread_registers.size() * sizeof(void*));
10661066
live_objects->push_back(AllocObject(&thread_registers[0],
10671067
thread_registers.size() * sizeof(void*),
@@ -1098,7 +1098,7 @@ void HeapLeakChecker::IgnoreNonThreadLiveObjectsLocked() {
10981098
for (IgnoredObjectsMap::const_iterator object = ignored_objects->begin();
10991099
object != ignored_objects->end(); ++object) {
11001100
const void* ptr = AsPtr(object->first);
1101-
RAW_VLOG(11, "Ignored live object at %p of %"PRIuS" bytes",
1101+
RAW_VLOG(11, "Ignored live object at %p of %" PRIuS " bytes",
11021102
ptr, object->second);
11031103
live_objects->
11041104
push_back(AllocObject(ptr, object->second, MUST_BE_ON_HEAP));
@@ -1107,7 +1107,7 @@ void HeapLeakChecker::IgnoreNonThreadLiveObjectsLocked() {
11071107
size_t object_size;
11081108
if (!(heap_profile->FindAlloc(ptr, &object_size) &&
11091109
object->second == object_size)) {
1110-
RAW_LOG(FATAL, "Object at %p of %"PRIuS" bytes from an"
1110+
RAW_LOG(FATAL, "Object at %p of %" PRIuS " bytes from an"
11111111
" IgnoreObject() has disappeared", ptr, object->second);
11121112
}
11131113
}
@@ -1214,7 +1214,7 @@ void HeapLeakChecker::IgnoreNonThreadLiveObjectsLocked() {
12141214
if (VLOG_IS_ON(11)) {
12151215
for (LiveObjectsStack::const_iterator i = l->second.begin();
12161216
i != l->second.end(); ++i) {
1217-
RAW_VLOG(11, "Library live region at %p of %"PRIuPTR" bytes",
1217+
RAW_VLOG(11, "Library live region at %p of %" PRIuPTR " bytes",
12181218
i->ptr, i->size);
12191219
}
12201220
}
@@ -1335,7 +1335,7 @@ void HeapLeakChecker::IgnoreAllLiveObjectsLocked(const void* self_stack_top) {
13351335
IgnoreNonThreadLiveObjectsLocked();
13361336
}
13371337
if (live_objects_total) {
1338-
RAW_VLOG(10, "Ignoring %"PRId64" reachable objects of %"PRId64" bytes",
1338+
RAW_VLOG(10, "Ignoring %" PRId64 " reachable objects of %" PRId64 " bytes",
13391339
live_objects_total, live_bytes_total);
13401340
}
13411341
// Free these: we made them here and heap_profile never saw them
@@ -1394,7 +1394,7 @@ static SpinLock alignment_checker_lock(SpinLock::LINKER_INITIALIZED);
13941394
live_object_count += 1;
13951395
live_byte_count += size;
13961396
}
1397-
RAW_VLOG(13, "Looking for heap pointers in %p of %"PRIuS" bytes",
1397+
RAW_VLOG(13, "Looking for heap pointers in %p of %" PRIuS " bytes",
13981398
object, size);
13991399
const char* const whole_object = object;
14001400
size_t const whole_size = size;
@@ -1465,8 +1465,8 @@ static SpinLock alignment_checker_lock(SpinLock::LINKER_INITIALIZED);
14651465
// a heap object which is in fact leaked.
14661466
// I.e. in very rare and probably not repeatable/lasting cases
14671467
// we might miss some real heap memory leaks.
1468-
RAW_VLOG(14, "Found pointer to %p of %"PRIuS" bytes at %p "
1469-
"inside %p of size %"PRIuS"",
1468+
RAW_VLOG(14, "Found pointer to %p of %" PRIuS " bytes at %p "
1469+
"inside %p of size %" PRIuS "",
14701470
ptr, object_size, object, whole_object, whole_size);
14711471
if (VLOG_IS_ON(15)) {
14721472
// log call stacks to help debug how come something is not a leak
@@ -1491,7 +1491,7 @@ static SpinLock alignment_checker_lock(SpinLock::LINKER_INITIALIZED);
14911491
live_objects_total += live_object_count;
14921492
live_bytes_total += live_byte_count;
14931493
if (live_object_count) {
1494-
RAW_VLOG(10, "Removed %"PRId64" live heap objects of %"PRId64" bytes: %s%s",
1494+
RAW_VLOG(10, "Removed %" PRId64 " live heap objects of %" PRId64 " bytes: %s%s",
14951495
live_object_count, live_byte_count, name, name2);
14961496
}
14971497
}
@@ -1513,7 +1513,7 @@ void HeapLeakChecker::DoIgnoreObject(const void* ptr) {
15131513
if (!HaveOnHeapLocked(&ptr, &object_size)) {
15141514
RAW_LOG(ERROR, "No live heap object at %p to ignore", ptr);
15151515
} else {
1516-
RAW_VLOG(10, "Going to ignore live object at %p of %"PRIuS" bytes",
1516+
RAW_VLOG(10, "Going to ignore live object at %p of %" PRIuS " bytes",
15171517
ptr, object_size);
15181518
if (ignored_objects == NULL) {
15191519
ignored_objects = new(Allocator::Allocate(sizeof(IgnoredObjectsMap)))
@@ -1540,7 +1540,7 @@ void HeapLeakChecker::UnIgnoreObject(const void* ptr) {
15401540
ignored_objects->erase(object);
15411541
found = true;
15421542
RAW_VLOG(10, "Now not going to ignore live object "
1543-
"at %p of %"PRIuS" bytes", ptr, object_size);
1543+
"at %p of %" PRIuS " bytes", ptr, object_size);
15441544
}
15451545
}
15461546
if (!found) RAW_LOG(FATAL, "Object at %p has not been ignored", ptr);
@@ -1588,8 +1588,8 @@ void HeapLeakChecker::Create(const char *name, bool make_start_snapshot) {
15881588
const HeapProfileTable::Stats& t = heap_profile->total();
15891589
const size_t start_inuse_bytes = t.alloc_size - t.free_size;
15901590
const size_t start_inuse_allocs = t.allocs - t.frees;
1591-
RAW_VLOG(10, "Start check \"%s\" profile: %"PRIuS" bytes "
1592-
"in %"PRIuS" objects",
1591+
RAW_VLOG(10, "Start check \"%s\" profile: %" PRIuS " bytes "
1592+
"in %" PRIuS " objects",
15931593
name_, start_inuse_bytes, start_inuse_allocs);
15941594
} else {
15951595
RAW_LOG(WARNING, "Heap checker is not active, "
@@ -1813,7 +1813,7 @@ bool HeapLeakChecker::DoNoLeaks(ShouldSymbolize should_symbolize) {
18131813
RAW_VLOG(heap_checker_info_level,
18141814
"No leaks found for check \"%s\" "
18151815
"(but no 100%% guarantee that there aren't any): "
1816-
"found %"PRId64" reachable heap objects of %"PRId64" bytes",
1816+
"found %" PRId64 " reachable heap objects of %" PRId64 " bytes",
18171817
name_,
18181818
int64(stats.allocs - stats.frees),
18191819
int64(stats.alloc_size - stats.free_size));
@@ -2353,7 +2353,7 @@ inline bool HeapLeakChecker::HaveOnHeapLocked(const void** ptr,
23532353
const uintptr_t addr = AsInt(*ptr);
23542354
if (heap_profile->FindInsideAlloc(
23552355
*ptr, max_heap_object_size, ptr, object_size)) {
2356-
RAW_VLOG(16, "Got pointer into %p at +%"PRIuPTR" offset",
2356+
RAW_VLOG(16, "Got pointer into %p at +%" PRIuPTR " offset",
23572357
*ptr, addr - AsInt(*ptr));
23582358
return true;
23592359
}

src/third_party/gperftools-2.0/src/heap-profile-table.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ int HeapProfileTable::UnparseBucket(const Bucket& b,
303303
profile_stats->free_size += b.free_size;
304304
}
305305
int printed =
306-
snprintf(buf + buflen, bufsize - buflen, "%6d: %8"PRId64" [%6d: %8"PRId64"] @%s",
306+
snprintf(buf + buflen, bufsize - buflen, "%6d: %8" PRId64 " [%6d: %8" PRId64 "] @%s",
307307
b.allocs - b.frees,
308308
b.alloc_size - b.free_size,
309309
b.allocs,
@@ -616,8 +616,8 @@ void HeapProfileTable::Snapshot::ReportLeaks(const char* checker_name,
616616
// This is only used by the heap leak checker, but is intimately
617617
// tied to the allocation map that belongs in this module and is
618618
// therefore placed here.
619-
RAW_LOG(ERROR, "Leak check %s detected leaks of %"PRIuS" bytes "
620-
"in %"PRIuS" objects",
619+
RAW_LOG(ERROR, "Leak check %s detected leaks of %" PRIuS " bytes "
620+
"in %" PRIuS " objects",
621621
checker_name,
622622
size_t(total_.alloc_size),
623623
size_t(total_.allocs));
@@ -663,7 +663,7 @@ void HeapProfileTable::Snapshot::ReportLeaks(const char* checker_name,
663663
e.bytes, e.count);
664664
for (int j = 0; j < e.bucket->depth; j++) {
665665
const void* pc = e.bucket->stack[j];
666-
printer.Printf("\t@ %"PRIxPTR" %s\n",
666+
printer.Printf("\t@ %" PRIxPTR " %s\n",
667667
reinterpret_cast<uintptr_t>(pc), symbolization_table.GetSymbol(pc));
668668
}
669669
RAW_LOG(ERROR, "%s", buffer);
@@ -687,7 +687,7 @@ void HeapProfileTable::Snapshot::ReportObject(const void* ptr,
687687
char* unused) {
688688
// Perhaps also log the allocation stack trace (unsymbolized)
689689
// on this line in case somebody finds it useful.
690-
RAW_LOG(ERROR, "leaked %"PRIuS" byte object %p", v->bytes, ptr);
690+
RAW_LOG(ERROR, "leaked %" PRIuS " byte object %p", v->bytes, ptr);
691691
}
692692

693693
void HeapProfileTable::Snapshot::ReportIndividualObjects() {

src/third_party/gperftools-2.0/src/heap-profiler.cc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -267,21 +267,21 @@ static void MaybeDumpProfileLocked() {
267267
if (FLAGS_heap_profile_allocation_interval > 0 &&
268268
total.alloc_size >=
269269
last_dump_alloc + FLAGS_heap_profile_allocation_interval) {
270-
snprintf(buf, sizeof(buf), ("%"PRId64" MB allocated cumulatively, "
271-
"%"PRId64" MB currently in use"),
270+
snprintf(buf, sizeof(buf), ("%" PRId64 " MB allocated cumulatively, "
271+
"%" PRId64 " MB currently in use"),
272272
total.alloc_size >> 20, inuse_bytes >> 20);
273273
need_to_dump = true;
274274
} else if (FLAGS_heap_profile_deallocation_interval > 0 &&
275275
total.free_size >=
276276
last_dump_free + FLAGS_heap_profile_deallocation_interval) {
277-
snprintf(buf, sizeof(buf), ("%"PRId64" MB freed cumulatively, "
278-
"%"PRId64" MB currently in use"),
277+
snprintf(buf, sizeof(buf), ("%" PRId64 " MB freed cumulatively, "
278+
"%" PRId64 " MB currently in use"),
279279
total.free_size >> 20, inuse_bytes >> 20);
280280
need_to_dump = true;
281281
} else if (FLAGS_heap_profile_inuse_interval > 0 &&
282282
inuse_bytes >
283283
high_water_mark + FLAGS_heap_profile_inuse_interval) {
284-
snprintf(buf, sizeof(buf), "%"PRId64" MB currently in use",
284+
snprintf(buf, sizeof(buf), "%" PRId64 " MB currently in use",
285285
inuse_bytes >> 20);
286286
need_to_dump = true;
287287
}
@@ -346,8 +346,8 @@ static void MmapHook(const void* result, const void* start, size_t size,
346346
// in pretty-printing of NULL as "nil".
347347
// TODO(maxim): instead should use a safe snprintf reimplementation
348348
RAW_LOG(INFO,
349-
"mmap(start=0x%"PRIxPTR", len=%"PRIuS", prot=0x%x, flags=0x%x, "
350-
"fd=%d, offset=0x%x) = 0x%"PRIxPTR"",
349+
"mmap(start=0x%" PRIxPTR ", len=%" PRIuS ", prot=0x%x, flags=0x%x, "
350+
"fd=%d, offset=0x%x) = 0x%" PRIxPTR "",
351351
(uintptr_t) start, size, prot, flags, fd, (unsigned int) offset,
352352
(uintptr_t) result);
353353
#ifdef TODO_REENABLE_STACK_TRACING
@@ -364,9 +364,9 @@ static void MremapHook(const void* result, const void* old_addr,
364364
// in pretty-printing of NULL as "nil".
365365
// TODO(maxim): instead should use a safe snprintf reimplementation
366366
RAW_LOG(INFO,
367-
"mremap(old_addr=0x%"PRIxPTR", old_size=%"PRIuS", "
368-
"new_size=%"PRIuS", flags=0x%x, new_addr=0x%"PRIxPTR") = "
369-
"0x%"PRIxPTR"",
367+
"mremap(old_addr=0x%" PRIxPTR ", old_size=%" PRIuS ", "
368+
"new_size=%" PRIuS ", flags=0x%x, new_addr=0x%" PRIxPTR ") = "
369+
"0x%" PRIxPTR "",
370370
(uintptr_t) old_addr, old_size, new_size, flags,
371371
(uintptr_t) new_addr, (uintptr_t) result);
372372
#ifdef TODO_REENABLE_STACK_TRACING
@@ -380,7 +380,7 @@ static void MunmapHook(const void* ptr, size_t size) {
380380
// We use PRIxS not just '%p' to avoid deadlocks
381381
// in pretty-printing of NULL as "nil".
382382
// TODO(maxim): instead should use a safe snprintf reimplementation
383-
RAW_LOG(INFO, "munmap(start=0x%"PRIxPTR", len=%"PRIuS")",
383+
RAW_LOG(INFO, "munmap(start=0x%" PRIxPTR ", len=%" PRIuS ")",
384384
(uintptr_t) ptr, size);
385385
#ifdef TODO_REENABLE_STACK_TRACING
386386
DumpStackTrace(1, RawInfoStackDumper, NULL);
@@ -390,7 +390,7 @@ static void MunmapHook(const void* ptr, size_t size) {
390390

391391
static void SbrkHook(const void* result, ptrdiff_t increment) {
392392
if (FLAGS_mmap_log) { // log it
393-
RAW_LOG(INFO, "sbrk(inc=%"PRIdS") = 0x%"PRIxPTR"",
393+
RAW_LOG(INFO, "sbrk(inc=%" PRIdS ") = 0x%" PRIxPTR "",
394394
increment, (uintptr_t) result);
395395
#ifdef TODO_REENABLE_STACK_TRACING
396396
DumpStackTrace(1, RawInfoStackDumper, NULL);

src/third_party/gperftools-2.0/src/malloc_extension.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ void PrintCountAndSize(MallocExtensionWriter* writer,
244244
uintptr_t count, uintptr_t size) {
245245
char buf[100];
246246
snprintf(buf, sizeof(buf),
247-
"%6"PRIu64": %8"PRIu64" [%6"PRIu64": %8"PRIu64"] @",
247+
"%6" PRIu64 ": %8" PRIu64 " [%6" PRIu64 ": %8" PRIu64 "] @",
248248
static_cast<uint64>(count),
249249
static_cast<uint64>(size),
250250
static_cast<uint64>(count),

0 commit comments

Comments
 (0)