This is an automated email from the ASF dual-hosted git repository.
alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push:
new 8e790439d [thirpdarty] upgrade gperftools to 2.13
8e790439d is described below
commit 8e790439d57e939ef3dc992b327ae3d1ac18b0fa
Author: Alexey Serbin <[email protected]>
AuthorDate: Fri Oct 6 18:03:29 2023 -0700
[thirpdarty] upgrade gperftools to 2.13
With gperftools 2.13 come many updates since 2.8.1. At least,
as a cumulative update from 2.11rc2 (a.k.a. 2.10.80 pre-release)
comes the support for generic_fp stack collection method on aarch64
platform [1], so now there is a parity between x86_64 and aarch64 builds
in terms of available options for stack trace collection in gperftools.
Also, the libgcc-based stacktrace capturing is more robust with the new
version of gperftools. In addition, version 2.13 includes many other
fixes since 2.8.1, for details see [2].
With the new version, by default gperftools are built with the
'-fno-omit-frame-pointer -momit-leaf-frame-pointer' flag combination
if supported by the platform, so I removed the --enable-frame-pointers
flag for the configure script.
The gperftools-tcmalloc-osx-fix.patch patch is no longer needed since
it's automatically "included" into the gperftools source code.
[1] https://github.com/gperftools/gperftools/releases/tag/gperftools-2.10.80
[2] https://github.com/gperftools/gperftools/releases
Change-Id: Ib4916bf64ea90bb148e0abf31779106a57061a15
Reviewed-on: http://gerrit.cloudera.org:8080/20545
Tested-by: Kudu Jenkins
Reviewed-by: Marton Greber <[email protected]>
Reviewed-by: Abhishek Chennaka <[email protected]>
---
thirdparty/build-definitions.sh | 1 -
thirdparty/download-thirdparty.sh | 3 +-
...ce-namespace-base-with-namespace-tcmalloc.patch | 1091 +++-----------------
.../patches/gperftools-tcmalloc-osx-fix.patch | 41 -
thirdparty/vars.sh | 2 +-
5 files changed, 132 insertions(+), 1006 deletions(-)
diff --git a/thirdparty/build-definitions.sh b/thirdparty/build-definitions.sh
index 8d84eb9d9..76d75b34d 100644
--- a/thirdparty/build-definitions.sh
+++ b/thirdparty/build-definitions.sh
@@ -469,7 +469,6 @@ build_glog() {
build_gperftools() {
local cfg_options="\
- --enable-frame-pointers\
--with-pic\
--prefix=$PREFIX\
--enable-emergency-malloc"
diff --git a/thirdparty/download-thirdparty.sh
b/thirdparty/download-thirdparty.sh
index 331a3fef8..bf64f29b4 100755
--- a/thirdparty/download-thirdparty.sh
+++ b/thirdparty/download-thirdparty.sh
@@ -191,13 +191,12 @@ fetch_and_patch \
$GFLAGS_SOURCE \
$GFLAGS_PATCHLEVEL
-GPERFTOOLS_PATCHLEVEL=3
+GPERFTOOLS_PATCHLEVEL=1
fetch_and_patch \
gperftools-${GPERFTOOLS_VERSION}.tar.gz \
$GPERFTOOLS_SOURCE \
$GPERFTOOLS_PATCHLEVEL \
"patch -p1 <
$TP_DIR/patches/gperftools-Replace-namespace-base-with-namespace-tcmalloc.patch"
\
- "patch -p1 < $TP_DIR/patches/gperftools-tcmalloc-osx-fix.patch" \
"autoreconf -fvi"
# NOTE: creating an empty 'third_party/googletest/m4' subdir is a recipe from
diff --git
a/thirdparty/patches/gperftools-Replace-namespace-base-with-namespace-tcmalloc.patch
b/thirdparty/patches/gperftools-Replace-namespace-base-with-namespace-tcmalloc.patch
index 44e974dfb..bccd556ea 100644
---
a/thirdparty/patches/gperftools-Replace-namespace-base-with-namespace-tcmalloc.patch
+++
b/thirdparty/patches/gperftools-Replace-namespace-base-with-namespace-tcmalloc.patch
@@ -1,472 +1,17 @@
-commit afca5dcb9a9e88487523d7e0d7ff917555dc1a51
-Author: Todd Lipcon <[email protected]>
-Date: Mon Mar 19 19:44:05 2018 -0700
+commit 8f04cffe25ca339841ce0ac67c98bb9a74caa9fc
+Author: Alexey Serbin <[email protected]>
+Date: Fri Oct 6 17:49:39 2023 -0700
Substitute namespaces
perl -p -i -e 's,base::,tcmalloc::,g' $(find . -name *.h -o -name \*.cc)
perl -p -i -e 's,namespace base,namespace tcmalloc,g' $(find . -name *.h
-o -name \*.cc)
-diff --git a/src/base/atomicops-internals-arm-generic.h
b/src/base/atomicops-internals-arm-generic.h
-index d0f9413..c81f1e6 100644
---- a/src/base/atomicops-internals-arm-generic.h
-+++ b/src/base/atomicops-internals-arm-generic.h
-@@ -44,7 +44,7 @@
-
- typedef int32_t Atomic32;
-
--namespace base {
-+namespace tcmalloc {
- namespace subtle {
-
- typedef int64_t Atomic64;
-@@ -222,7 +222,7 @@ inline Atomic64 Release_CompareAndSwap(volatile Atomic64*
ptr,
- return 0;
- }
-
--} // namespace base::subtle
--} // namespace base
-+} // namespace tcmalloc::subtle
-+} // namespace tcmalloc
-
- #endif // BASE_ATOMICOPS_INTERNALS_ARM_GENERIC_H_
-diff --git a/src/base/atomicops-internals-arm-v6plus.h
b/src/base/atomicops-internals-arm-v6plus.h
-index 35f1048..c61ef24 100644
---- a/src/base/atomicops-internals-arm-v6plus.h
-+++ b/src/base/atomicops-internals-arm-v6plus.h
-@@ -52,7 +52,7 @@
-
- typedef int32_t Atomic32;
-
--namespace base {
-+namespace tcmalloc {
- namespace subtle {
-
- typedef int64_t Atomic64;
-@@ -325,6 +325,6 @@ inline Atomic64 Release_CompareAndSwap(volatile Atomic64*
ptr,
- }
-
- } // namespace subtle ends
--} // namespace base ends
-+} // namespace tcmalloc ends
-
- #endif // BASE_ATOMICOPS_INTERNALS_ARM_V6PLUS_H_
-diff --git a/src/base/atomicops-internals-gcc.h
b/src/base/atomicops-internals-gcc.h
-index f8d2786..d633579 100644
---- a/src/base/atomicops-internals-gcc.h
-+++ b/src/base/atomicops-internals-gcc.h
-@@ -44,7 +44,7 @@
-
- typedef int32_t Atomic32;
-
--namespace base {
-+namespace tcmalloc {
- namespace subtle {
-
- typedef int64_t Atomic64;
-@@ -197,7 +197,7 @@ inline Atomic64 Release_Load(volatile const Atomic64* ptr)
{
- return *ptr;
- }
-
--} // namespace base::subtle
--} // namespace base
-+} // namespace tcmalloc::subtle
-+} // namespace tcmalloc
-
- #endif // BASE_ATOMICOPS_INTERNALS_GCC_GENERIC_H_
-diff --git a/src/base/atomicops-internals-linuxppc.h
b/src/base/atomicops-internals-linuxppc.h
-index b52fdf0..f174bf4 100644
---- a/src/base/atomicops-internals-linuxppc.h
-+++ b/src/base/atomicops-internals-linuxppc.h
-@@ -44,7 +44,7 @@ typedef int32_t Atomic32;
- #define BASE_HAS_ATOMIC64 1
- #endif
-
--namespace base {
-+namespace tcmalloc {
- namespace subtle {
-
- static inline void _sync(void) {
-@@ -431,7 +431,7 @@ inline Atomic64 Release_Load(volatile const Atomic64 *ptr)
{
-
- #endif
-
--} // namespace base::subtle
--} // namespace base
-+} // namespace tcmalloc::subtle
-+} // namespace tcmalloc
-
- #endif // BASE_ATOMICOPS_INTERNALS_LINUXPPC_H_
-diff --git a/src/base/atomicops-internals-macosx.h
b/src/base/atomicops-internals-macosx.h
-index b5130d4..2c53646 100644
---- a/src/base/atomicops-internals-macosx.h
-+++ b/src/base/atomicops-internals-macosx.h
-@@ -43,7 +43,7 @@ typedef int32_t Atomic32;
- // AtomicWord and Atomic64 are always different. Thus, we need explicit
- // casting.
- #ifdef __LP64__
--#define AtomicWordCastType base::subtle::Atomic64
-+#define AtomicWordCastType tcmalloc::subtle::Atomic64
- #else
- #define AtomicWordCastType Atomic32
- #endif
-@@ -54,7 +54,7 @@ typedef int32_t Atomic32;
-
- #include <libkern/OSAtomic.h>
-
--namespace base {
-+namespace tcmalloc {
- namespace subtle {
-
- #if !defined(__LP64__) && defined(__ppc__)
-@@ -364,7 +364,7 @@ inline Atomic64 Release_Load(volatile const Atomic64 *ptr)
{
- }
- #endif // __LP64__
-
--} // namespace base::subtle
--} // namespace base
-+} // namespace tcmalloc::subtle
-+} // namespace tcmalloc
-
- #endif // BASE_ATOMICOPS_INTERNALS_MACOSX_H_
-diff --git a/src/base/atomicops-internals-mips.h
b/src/base/atomicops-internals-mips.h
-index 4bfd7f6..612abb4 100644
---- a/src/base/atomicops-internals-mips.h
-+++ b/src/base/atomicops-internals-mips.h
-@@ -45,7 +45,7 @@
-
- typedef int32_t Atomic32;
-
--namespace base {
-+namespace tcmalloc {
- namespace subtle {
-
- // Atomically execute:
-@@ -317,7 +317,7 @@ inline Atomic64 Release_Load(volatile const Atomic64* ptr)
-
- #endif
-
--} // namespace base::subtle
--} // namespace base
-+} // namespace tcmalloc::subtle
-+} // namespace tcmalloc
-
- #endif // BASE_ATOMICOPS_INTERNALS_MIPS_H_
-diff --git a/src/base/atomicops-internals-windows.h
b/src/base/atomicops-internals-windows.h
-index 93ced87..4331b71 100644
---- a/src/base/atomicops-internals-windows.h
-+++ b/src/base/atomicops-internals-windows.h
-@@ -49,7 +49,7 @@ typedef int32 Atomic32;
- #define BASE_HAS_ATOMIC64 1 // Use only in tests and base/atomic*
- #endif
-
--namespace base {
-+namespace tcmalloc {
- namespace subtle {
-
- typedef int64 Atomic64;
-@@ -150,8 +150,8 @@ inline Atomic32 Release_AtomicExchange(volatile Atomic32*
ptr,
- return NoBarrier_AtomicExchange(ptr, new_value);
- }
-
--} // namespace base::subtle
--} // namespace base
-+} // namespace tcmalloc::subtle
-+} // namespace tcmalloc
-
-
- // In msvc8/vs2005, winnt.h already contains a definition for
-@@ -160,12 +160,12 @@ inline Atomic32 Release_AtomicExchange(volatile
Atomic32* ptr,
- #if !(defined(_MSC_VER) && _MSC_VER >= 1400)
- inline void MemoryBarrier() {
- Atomic32 value = 0;
-- base::subtle::NoBarrier_AtomicExchange(&value, 0);
-+ tcmalloc::subtle::NoBarrier_AtomicExchange(&value, 0);
- // actually acts as a barrier in thisd implementation
- }
- #endif
-
--namespace base {
-+namespace tcmalloc {
- namespace subtle {
-
- inline void MemoryBarrier() {
-@@ -451,7 +451,7 @@ inline Atomic64 Release_CompareAndSwap(volatile Atomic64*
ptr,
- return NoBarrier_CompareAndSwap(ptr, old_value, new_value);
- }
-
--} // namespace base::subtle
--} // namespace base
-+} // namespace tcmalloc::subtle
-+} // namespace tcmalloc
-
- #endif // BASE_ATOMICOPS_INTERNALS_WINDOWS_H_
-diff --git a/src/base/atomicops-internals-x86.h
b/src/base/atomicops-internals-x86.h
-index e441ac7..32751dc 100644
---- a/src/base/atomicops-internals-x86.h
-+++ b/src/base/atomicops-internals-x86.h
-@@ -64,7 +64,7 @@ extern struct AtomicOps_x86CPUFeatureStruct
AtomicOps_Internalx86CPUFeatures;
- #define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory")
-
-
--namespace base {
-+namespace tcmalloc {
- namespace subtle {
-
- typedef int64_t Atomic64;
-@@ -383,8 +383,8 @@ inline Atomic64 Release_CompareAndSwap(volatile Atomic64*
ptr,
- return NoBarrier_CompareAndSwap(ptr, old_value, new_value);
- }
-
--} // namespace base::subtle
--} // namespace base
-+} // namespace tcmalloc::subtle
-+} // namespace tcmalloc
-
- #undef ATOMICOPS_COMPILER_BARRIER
-
-diff --git a/src/base/atomicops.h b/src/base/atomicops.h
-index dac95be..069a495 100644
---- a/src/base/atomicops.h
-+++ b/src/base/atomicops.h
-@@ -67,12 +67,12 @@
- // NoBarrier_Store()
- // NoBarrier_Load()
- // Although there are currently no compiler enforcement, you are encouraged
--// to use these. Moreover, if you choose to use base::subtle::Atomic64 type,
-+// to use these. Moreover, if you choose to use tcmalloc::subtle::Atomic64
type,
- // you MUST use one of the Load or Store routines to get correct behavior
- // on 32-bit platforms.
- //
- // The intent is eventually to put all of these routines in namespace
--// base::subtle
-+// tcmalloc::subtle
-
- #ifndef THREAD_ATOMICOPS_H_
- #define THREAD_ATOMICOPS_H_
-@@ -90,7 +90,7 @@
- // should define the macro, AtomicWordCastType in a clause similar to the
- // following:
- // #if ...pointers are 64 bits...
--// # define AtomicWordCastType base::subtle::Atomic64
-+// # define AtomicWordCastType tcmalloc::subtle::Atomic64
- // #else
- // # define AtomicWordCastType Atomic32
- // #endif
-@@ -143,7 +143,7 @@ typedef intptr_t AtomicWord;
- // It also serves to document the AtomicWord interface.
- // ------------------------------------------------------------------------
-
--namespace base {
-+namespace tcmalloc {
- namespace subtle {
-
- // Atomically execute:
-@@ -187,7 +187,7 @@ inline AtomicWord Release_AtomicExchange(volatile
AtomicWord* ptr,
- inline AtomicWord Acquire_CompareAndSwap(volatile AtomicWord* ptr,
- AtomicWord old_value,
- AtomicWord new_value) {
-- return base::subtle::Acquire_CompareAndSwap(
-+ return tcmalloc::subtle::Acquire_CompareAndSwap(
- reinterpret_cast<volatile AtomicWordCastType*>(ptr),
- old_value, new_value);
- }
-@@ -195,7 +195,7 @@ inline AtomicWord Acquire_CompareAndSwap(volatile
AtomicWord* ptr,
- inline AtomicWord Release_CompareAndSwap(volatile AtomicWord* ptr,
- AtomicWord old_value,
- AtomicWord new_value) {
-- return base::subtle::Release_CompareAndSwap(
-+ return tcmalloc::subtle::Release_CompareAndSwap(
- reinterpret_cast<volatile AtomicWordCastType*>(ptr),
- old_value, new_value);
- }
-@@ -206,12 +206,12 @@ inline void NoBarrier_Store(volatile AtomicWord *ptr,
AtomicWord value) {
- }
-
- inline void Acquire_Store(volatile AtomicWord* ptr, AtomicWord value) {
-- return base::subtle::Acquire_Store(
-+ return tcmalloc::subtle::Acquire_Store(
- reinterpret_cast<volatile AtomicWordCastType*>(ptr), value);
- }
-
- inline void Release_Store(volatile AtomicWord* ptr, AtomicWord value) {
-- return base::subtle::Release_Store(
-+ return tcmalloc::subtle::Release_Store(
- reinterpret_cast<volatile AtomicWordCastType*>(ptr), value);
- }
-
-@@ -221,17 +221,17 @@ inline AtomicWord NoBarrier_Load(volatile const
AtomicWord *ptr) {
- }
-
- inline AtomicWord Acquire_Load(volatile const AtomicWord* ptr) {
-- return base::subtle::Acquire_Load(
-+ return tcmalloc::subtle::Acquire_Load(
- reinterpret_cast<volatile const AtomicWordCastType*>(ptr));
- }
-
- inline AtomicWord Release_Load(volatile const AtomicWord* ptr) {
-- return base::subtle::Release_Load(
-+ return tcmalloc::subtle::Release_Load(
- reinterpret_cast<volatile const AtomicWordCastType*>(ptr));
- }
-
--} // namespace base::subtle
--} // namespace base
-+} // namespace tcmalloc::subtle
-+} // namespace tcmalloc
- #endif // AtomicWordCastType
-
- // ------------------------------------------------------------------------
-@@ -247,7 +247,7 @@ inline AtomicWord Release_Load(volatile const AtomicWord*
ptr) {
- typedef int32_t Atomic32;
-
- // Corresponding operations on Atomic32
--namespace base {
-+namespace tcmalloc {
- namespace subtle {
-
- // Signed 64-bit type that supports the atomic ops below, as well as atomic
-@@ -294,8 +294,8 @@ void Release_Store(volatile Atomic64* ptr, Atomic64 value);
- Atomic64 NoBarrier_Load(volatile const Atomic64* ptr);
- Atomic64 Acquire_Load(volatile const Atomic64* ptr);
- Atomic64 Release_Load(volatile const Atomic64* ptr);
--} // namespace base::subtle
--} // namespace base
-+} // namespace tcmalloc::subtle
-+} // namespace tcmalloc
-
- void MemoryBarrier();
-
-@@ -304,7 +304,7 @@ void MemoryBarrier();
-
- // ------------------------------------------------------------------------
- // The following are to be deprecated when all uses have been changed to
--// use the base::subtle namespace.
-+// use the tcmalloc::subtle namespace.
- // ------------------------------------------------------------------------
-
- #ifdef AtomicWordCastType
-@@ -312,29 +312,29 @@ void MemoryBarrier();
- inline AtomicWord Acquire_CompareAndSwap(volatile AtomicWord* ptr,
- AtomicWord old_value,
- AtomicWord new_value) {
-- return base::subtle::Acquire_CompareAndSwap(ptr, old_value, new_value);
-+ return tcmalloc::subtle::Acquire_CompareAndSwap(ptr, old_value, new_value);
- }
-
- inline AtomicWord Release_CompareAndSwap(volatile AtomicWord* ptr,
- AtomicWord old_value,
- AtomicWord new_value) {
-- return base::subtle::Release_CompareAndSwap(ptr, old_value, new_value);
-+ return tcmalloc::subtle::Release_CompareAndSwap(ptr, old_value, new_value);
- }
-
- inline void Acquire_Store(volatile AtomicWord* ptr, AtomicWord value) {
-- return base::subtle::Acquire_Store(ptr, value);
-+ return tcmalloc::subtle::Acquire_Store(ptr, value);
- }
-
- inline void Release_Store(volatile AtomicWord* ptr, AtomicWord value) {
-- return base::subtle::Release_Store(ptr, value);
-+ return tcmalloc::subtle::Release_Store(ptr, value);
- }
-
- inline AtomicWord Acquire_Load(volatile const AtomicWord* ptr) {
-- return base::subtle::Acquire_Load(ptr);
-+ return tcmalloc::subtle::Acquire_Load(ptr);
- }
-
- inline AtomicWord Release_Load(volatile const AtomicWord* ptr) {
-- return base::subtle::Release_Load(ptr);
-+ return tcmalloc::subtle::Release_Load(ptr);
- }
- #endif // AtomicWordCastType
-
-@@ -343,55 +343,55 @@ inline AtomicWord Release_Load(volatile const
AtomicWord* ptr) {
- inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
- Atomic32 old_value,
- Atomic32 new_value) {
-- return base::subtle::Acquire_CompareAndSwap(ptr, old_value, new_value);
-+ return tcmalloc::subtle::Acquire_CompareAndSwap(ptr, old_value, new_value);
- }
- inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
- Atomic32 old_value,
- Atomic32 new_value) {
-- return base::subtle::Release_CompareAndSwap(ptr, old_value, new_value);
-+ return tcmalloc::subtle::Release_CompareAndSwap(ptr, old_value, new_value);
- }
- inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
-- base::subtle::Acquire_Store(ptr, value);
-+ tcmalloc::subtle::Acquire_Store(ptr, value);
- }
- inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
-- return base::subtle::Release_Store(ptr, value);
-+ return tcmalloc::subtle::Release_Store(ptr, value);
- }
- inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
-- return base::subtle::Acquire_Load(ptr);
-+ return tcmalloc::subtle::Acquire_Load(ptr);
- }
- inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
-- return base::subtle::Release_Load(ptr);
-+ return tcmalloc::subtle::Release_Load(ptr);
- }
-
- #ifdef BASE_HAS_ATOMIC64
-
- // 64-bit Acquire/Release operations to be deprecated.
-
--inline base::subtle::Atomic64 Acquire_CompareAndSwap(
-- volatile base::subtle::Atomic64* ptr,
-- base::subtle::Atomic64 old_value, base::subtle::Atomic64 new_value) {
-- return base::subtle::Acquire_CompareAndSwap(ptr, old_value, new_value);
-+inline tcmalloc::subtle::Atomic64 Acquire_CompareAndSwap(
-+ volatile tcmalloc::subtle::Atomic64* ptr,
-+ tcmalloc::subtle::Atomic64 old_value, tcmalloc::subtle::Atomic64
new_value) {
-+ return tcmalloc::subtle::Acquire_CompareAndSwap(ptr, old_value, new_value);
- }
--inline base::subtle::Atomic64 Release_CompareAndSwap(
-- volatile base::subtle::Atomic64* ptr,
-- base::subtle::Atomic64 old_value, base::subtle::Atomic64 new_value) {
-- return base::subtle::Release_CompareAndSwap(ptr, old_value, new_value);
-+inline tcmalloc::subtle::Atomic64 Release_CompareAndSwap(
-+ volatile tcmalloc::subtle::Atomic64* ptr,
-+ tcmalloc::subtle::Atomic64 old_value, tcmalloc::subtle::Atomic64
new_value) {
-+ return tcmalloc::subtle::Release_CompareAndSwap(ptr, old_value, new_value);
- }
- inline void Acquire_Store(
-- volatile base::subtle::Atomic64* ptr, base::subtle::Atomic64 value) {
-- base::subtle::Acquire_Store(ptr, value);
-+ volatile tcmalloc::subtle::Atomic64* ptr, tcmalloc::subtle::Atomic64
value) {
-+ tcmalloc::subtle::Acquire_Store(ptr, value);
- }
- inline void Release_Store(
-- volatile base::subtle::Atomic64* ptr, base::subtle::Atomic64 value) {
-- return base::subtle::Release_Store(ptr, value);
-+ volatile tcmalloc::subtle::Atomic64* ptr, tcmalloc::subtle::Atomic64
value) {
-+ return tcmalloc::subtle::Release_Store(ptr, value);
- }
--inline base::subtle::Atomic64 Acquire_Load(
-- volatile const base::subtle::Atomic64* ptr) {
-- return base::subtle::Acquire_Load(ptr);
-+inline tcmalloc::subtle::Atomic64 Acquire_Load(
-+ volatile const tcmalloc::subtle::Atomic64* ptr) {
-+ return tcmalloc::subtle::Acquire_Load(ptr);
- }
--inline base::subtle::Atomic64 Release_Load(
-- volatile const base::subtle::Atomic64* ptr) {
-- return base::subtle::Release_Load(ptr);
-+inline tcmalloc::subtle::Atomic64 Release_Load(
-+ volatile const tcmalloc::subtle::Atomic64* ptr) {
-+ return tcmalloc::subtle::Release_Load(ptr);
- }
-
- #endif // BASE_HAS_ATOMIC64
diff --git a/src/base/basictypes.h b/src/base/basictypes.h
-index 42dbe5c..b825290 100644
+index a6b60ad..144a2e0 100644
--- a/src/base/basictypes.h
+++ b/src/base/basictypes.h
-@@ -421,15 +421,15 @@ union MemoryAligner {
+@@ -422,15 +422,15 @@ union MemoryAligner {
// that the variable has static storage class, and that the constructor should
// do nothing to its state. It indicates to the reader that it is legal to
// declare a static nistance of the class, provided the constructor is given
@@ -530,7 +75,7 @@ index 5fb00ff..4fef045 100644
#endif // __ELF__ and __GLIBC__ and !__native_client__
diff --git a/src/base/spinlock.cc b/src/base/spinlock.cc
-index 85ff21e..6fbf226 100644
+index d1b130b..49c7374 100644
--- a/src/base/spinlock.cc
+++ b/src/base/spinlock.cc
@@ -45,8 +45,8 @@
@@ -544,38 +89,7 @@ index 85ff21e..6fbf226 100644
namespace {
struct SpinLock_InitHelper {
-@@ -77,10 +77,10 @@ inline void SpinlockPause(void) {
- // from the lock is returned from the method.
- Atomic32 SpinLock::SpinLoop() {
- int c = adaptive_spin_count;
-- while (base::subtle::NoBarrier_Load(&lockword_) != kSpinLockFree && --c >
0) {
-+ while (tcmalloc::subtle::NoBarrier_Load(&lockword_) != kSpinLockFree && --c
> 0) {
- SpinlockPause();
- }
-- return base::subtle::Acquire_CompareAndSwap(&lockword_, kSpinLockFree,
-+ return tcmalloc::subtle::Acquire_CompareAndSwap(&lockword_, kSpinLockFree,
- kSpinLockSleeper);
- }
-
-@@ -95,7 +95,7 @@ void SpinLock::SlowLock() {
- // Here, just "mark" that the thread is going to sleep. Don't store the
- // lock wait time in the lock as that will cause the current lock
- // owner to think it experienced contention.
-- lock_value = base::subtle::Acquire_CompareAndSwap(&lockword_,
-+ lock_value = tcmalloc::subtle::Acquire_CompareAndSwap(&lockword_,
- kSpinLockHeld,
- kSpinLockSleeper);
- if (lock_value == kSpinLockHeld) {
-@@ -107,7 +107,7 @@ void SpinLock::SlowLock() {
- // Lock is free again, so try and acquire it before sleeping. The
- // new lock state will be the number of cycles this thread waited if
- // this thread obtains the lock.
-- lock_value = base::subtle::Acquire_CompareAndSwap(&lockword_,
-+ lock_value = tcmalloc::subtle::Acquire_CompareAndSwap(&lockword_,
- kSpinLockFree,
- kSpinLockSleeper);
- continue; // skip the delay at the end of the loop
-@@ -115,7 +115,7 @@ void SpinLock::SlowLock() {
+@@ -130,7 +130,7 @@ void SpinLock::SlowLock() {
}
// Wait for an OS specific delay.
@@ -584,7 +98,7 @@ index 85ff21e..6fbf226 100644
++lock_wait_call_count);
// Spin again after returning from the wait routine to give this thread
// some chance of obtaining the lock.
-@@ -125,5 +125,5 @@ void SpinLock::SlowLock() {
+@@ -140,5 +140,5 @@ void SpinLock::SlowLock() {
void SpinLock::SlowUnlock() {
// wake waiter if necessary
@@ -592,10 +106,10 @@ index 85ff21e..6fbf226 100644
+ tcmalloc::internal::SpinLockWake(&lockword_, false);
}
diff --git a/src/base/spinlock.h b/src/base/spinlock.h
-index 7243aea..3bf3ad9 100644
+index b336c45..510c13e 100644
--- a/src/base/spinlock.h
+++ b/src/base/spinlock.h
-@@ -51,14 +51,14 @@ class LOCKABLE SpinLock {
+@@ -54,14 +54,14 @@ class LOCKABLE SpinLock {
// Special constructor for use with static SpinLock objects. E.g.,
//
@@ -612,39 +126,8 @@ index 7243aea..3bf3ad9 100644
// Does nothing; lockword_ is already initialized
}
-@@ -66,7 +66,7 @@ class LOCKABLE SpinLock {
- // TODO(csilvers): uncomment the annotation when we figure out how to
- // support this macro with 0 args (see thread_annotations.h)
- inline void Lock() /*EXCLUSIVE_LOCK_FUNCTION()*/ {
-- if (base::subtle::Acquire_CompareAndSwap(&lockword_, kSpinLockFree,
-+ if (tcmalloc::subtle::Acquire_CompareAndSwap(&lockword_, kSpinLockFree,
- kSpinLockHeld) != kSpinLockFree)
{
- SlowLock();
- }
-@@ -79,7 +79,7 @@ class LOCKABLE SpinLock {
- // will return true with high probability.
- inline bool TryLock() EXCLUSIVE_TRYLOCK_FUNCTION(true) {
- bool res =
-- (base::subtle::Acquire_CompareAndSwap(&lockword_, kSpinLockFree,
-+ (tcmalloc::subtle::Acquire_CompareAndSwap(&lockword_, kSpinLockFree,
- kSpinLockHeld) ==
kSpinLockFree);
- if (res) {
- ANNOTATE_RWLOCK_ACQUIRED(this, 1);
-@@ -93,7 +93,7 @@ class LOCKABLE SpinLock {
- inline void Unlock() /*UNLOCK_FUNCTION()*/ {
- ANNOTATE_RWLOCK_RELEASED(this, 1);
- uint64 prev_value = static_cast<uint64>(
-- base::subtle::Release_AtomicExchange(&lockword_, kSpinLockFree));
-+ tcmalloc::subtle::Release_AtomicExchange(&lockword_, kSpinLockFree));
- if (prev_value != kSpinLockHeld) {
- // Speed the wakeup of any waiter.
- SlowUnlock();
-@@ -104,10 +104,10 @@ class LOCKABLE SpinLock {
- // thread, true will always be returned. Intended to be used as
- // CHECK(lock.IsHeld()).
- inline bool IsHeld() const {
-- return base::subtle::NoBarrier_Load(&lockword_) != kSpinLockFree;
-+ return tcmalloc::subtle::NoBarrier_Load(&lockword_) != kSpinLockFree;
+@@ -98,7 +98,7 @@ class LOCKABLE SpinLock {
+ return lockword_.load(std::memory_order_relaxed) != kSpinLockFree;
}
- static const base::LinkerInitialized LINKER_INITIALIZED; // backwards
compat
@@ -653,7 +136,7 @@ index 7243aea..3bf3ad9 100644
enum { kSpinLockFree = 0 };
enum { kSpinLockHeld = 1 };
diff --git a/src/base/spinlock_internal.cc b/src/base/spinlock_internal.cc
-index d962971..af6015d 100644
+index 204b4ce..72dc5ad 100644
--- a/src/base/spinlock_internal.cc
+++ b/src/base/spinlock_internal.cc
@@ -30,7 +30,7 @@
@@ -664,7 +147,7 @@ index d962971..af6015d 100644
+// tcmalloc::internal::SpinLockDelay() and tcmalloc::internal::SpinLockWake().
// See spinlock_internal.h for the spec of SpinLockWake().
- // void SpinLockDelay(volatile Atomic32 *w, int32 value, int loop)
+ // void SpinLockDelay(std::atomic<int> *w, int32 value, int loop)
@@ -44,7 +44,7 @@
#include "base/spinlock_internal.h"
@@ -683,62 +166,36 @@ index d962971..af6015d 100644
namespace internal {
// Return a suggested delay in nanoseconds for iteration number "loop"
-@@ -62,10 +62,10 @@ static int SuggestedDelayNS(int loop) {
- // Weak pseudo-random number generator to get some spread between threads
- // when many are spinning.
- #ifdef BASE_HAS_ATOMIC64
-- static base::subtle::Atomic64 rand;
-- uint64 r = base::subtle::NoBarrier_Load(&rand);
-+ static tcmalloc::subtle::Atomic64 rand;
-+ uint64 r = tcmalloc::subtle::NoBarrier_Load(&rand);
- r = 0x5deece66dLL * r + 0xb; // numbers from nrand48()
-- base::subtle::NoBarrier_Store(&rand, r);
-+ tcmalloc::subtle::NoBarrier_Store(&rand, r);
-
- r <<= 16; // 48-bit random number now in top 48-bits.
- if (loop < 0 || loop > 32) { // limit loop to 0..32
-@@ -80,9 +80,9 @@ static int SuggestedDelayNS(int loop) {
- return r >> (44 - (loop >> 3));
- #else
- static Atomic32 rand;
-- uint32 r = base::subtle::NoBarrier_Load(&rand);
-+ uint32 r = tcmalloc::subtle::NoBarrier_Load(&rand);
- r = 0x343fd * r + 0x269ec3; // numbers from MSVC++
-- base::subtle::NoBarrier_Store(&rand, r);
-+ tcmalloc::subtle::NoBarrier_Store(&rand, r);
-
- r <<= 1; // 31-bit random number now in top 31-bits.
- if (loop < 0 || loop > 32) { // limit loop to 0..32
-@@ -99,4 +99,4 @@ static int SuggestedDelayNS(int loop) {
+@@ -80,4 +80,4 @@ static int SuggestedDelayNS(int loop) {
}
} // namespace internal
-} // namespace base
+} // namespace tcmalloc
diff --git a/src/base/spinlock_internal.h b/src/base/spinlock_internal.h
-index aa47e67..657b7ca 100644
+index 4d74784..64a4bc0 100644
--- a/src/base/spinlock_internal.h
+++ b/src/base/spinlock_internal.h
-@@ -40,12 +40,12 @@
+@@ -42,12 +42,12 @@
+
#include "base/basictypes.h"
- #include "base/atomicops.h"
-namespace base {
+namespace tcmalloc {
namespace internal {
- void SpinLockWake(volatile Atomic32 *w, bool all);
- void SpinLockDelay(volatile Atomic32 *w, int32 value, int loop);
+ void SpinLockWake(std::atomic<int> *w, bool all);
+ void SpinLockDelay(std::atomic<int> *w, int32 value, int loop);
} // namespace internal
-} // namespace base
+} // namespace tcmalloc
#endif
diff --git a/src/base/spinlock_linux-inl.h b/src/base/spinlock_linux-inl.h
-index aadf62a..ffd0e72 100644
+index 3f449d4..f602f69 100644
--- a/src/base/spinlock_linux-inl.h
+++ b/src/base/spinlock_linux-inl.h
-@@ -63,7 +63,7 @@ static struct InitModule {
+@@ -66,7 +66,7 @@ static struct InitModule {
} // anonymous namespace
@@ -746,8 +203,8 @@ index aadf62a..ffd0e72 100644
+namespace tcmalloc {
namespace internal {
- void SpinLockDelay(volatile Atomic32 *w, int32 value, int loop) {
-@@ -72,7 +72,7 @@ void SpinLockDelay(volatile Atomic32 *w, int32 value, int
loop) {
+ void SpinLockDelay(std::atomic<int> *w, int32 value, int loop) {
+@@ -75,7 +75,7 @@ void SpinLockDelay(std::atomic<int> *w, int32 value, int
loop) {
struct timespec tm;
tm.tv_sec = 0;
if (have_futex) {
@@ -756,14 +213,14 @@ index aadf62a..ffd0e72 100644
} else {
tm.tv_nsec = 2000001; // above 2ms so linux 2.4 doesn't spin
}
-@@ -98,4 +98,4 @@ void SpinLockWake(volatile Atomic32 *w, bool all) {
+@@ -99,4 +99,4 @@ void SpinLockWake(std::atomic<int> *w, bool all) {
}
} // namespace internal
-} // namespace base
+} // namespace tcmalloc
diff --git a/src/base/spinlock_posix-inl.h b/src/base/spinlock_posix-inl.h
-index e73a30f..2507ae2 100644
+index 2402cb4..5899c80 100644
--- a/src/base/spinlock_posix-inl.h
+++ b/src/base/spinlock_posix-inl.h
@@ -39,7 +39,7 @@
@@ -774,8 +231,8 @@ index e73a30f..2507ae2 100644
+namespace tcmalloc {
namespace internal {
- void SpinLockDelay(volatile Atomic32 *w, int32 value, int loop) {
-@@ -50,7 +50,7 @@ void SpinLockDelay(volatile Atomic32 *w, int32 value, int
loop) {
+ void SpinLockDelay(std::atomic<int> *w, int32 value, int loop) {
+@@ -50,7 +50,7 @@ void SpinLockDelay(std::atomic<int> *w, int32 value, int
loop) {
} else {
struct timespec tm;
tm.tv_sec = 0;
@@ -784,14 +241,14 @@ index e73a30f..2507ae2 100644
nanosleep(&tm, NULL);
}
errno = save_errno;
-@@ -60,4 +60,4 @@ void SpinLockWake(volatile Atomic32 *w, bool all) {
+@@ -60,4 +60,4 @@ void SpinLockWake(std::atomic<int> *w, bool all) {
}
} // namespace internal
-} // namespace base
+} // namespace tcmalloc
diff --git a/src/base/spinlock_win32-inl.h b/src/base/spinlock_win32-inl.h
-index 956b965..bbf630b 100644
+index d511999..c0791a4 100644
--- a/src/base/spinlock_win32-inl.h
+++ b/src/base/spinlock_win32-inl.h
@@ -35,7 +35,7 @@
@@ -802,8 +259,8 @@ index 956b965..bbf630b 100644
+namespace tcmalloc {
namespace internal {
- void SpinLockDelay(volatile Atomic32 *w, int32 value, int loop) {
-@@ -43,7 +43,7 @@ void SpinLockDelay(volatile Atomic32 *w, int32 value, int
loop) {
+ void SpinLockDelay(std::atomic<int> *w, int32 value, int loop) {
+@@ -43,7 +43,7 @@ void SpinLockDelay(std::atomic<int> *w, int32 value, int
loop) {
} else if (loop == 1) {
Sleep(0);
} else {
@@ -812,24 +269,17 @@ index 956b965..bbf630b 100644
}
}
-@@ -51,4 +51,4 @@ void SpinLockWake(volatile Atomic32 *w, bool all) {
+@@ -51,4 +51,4 @@ void SpinLockWake(std::atomic<int> *w, bool all) {
}
} // namespace internal
-} // namespace base
+} // namespace tcmalloc
diff --git a/src/base/vdso_support.cc b/src/base/vdso_support.cc
-index 730df30..70aaef5 100644
+index 1e3c5b3..49da304 100644
--- a/src/base/vdso_support.cc
+++ b/src/base/vdso_support.cc
-@@ -48,13 +48,13 @@
- #include "base/dynamic_annotations.h"
- #include "base/basictypes.h" // for COMPILE_ASSERT
-
--using base::subtle::MemoryBarrier;
-+using tcmalloc::subtle::MemoryBarrier;
-
- #ifndef AT_SYSINFO_EHDR
+@@ -51,7 +51,7 @@
#define AT_SYSINFO_EHDR 33
#endif
@@ -839,10 +289,10 @@ index 730df30..70aaef5 100644
const void *VDSOSupport::vdso_base_ = ElfMemImage::kInvalidBase;
VDSOSupport::VDSOSupport()
diff --git a/src/base/vdso_support.h b/src/base/vdso_support.h
-index c1209a4..97545a2 100644
+index 073386c..d85b764 100644
--- a/src/base/vdso_support.h
+++ b/src/base/vdso_support.h
-@@ -65,7 +65,7 @@
+@@ -70,7 +70,7 @@
#include <stdlib.h> // for NULL
@@ -851,7 +301,7 @@ index c1209a4..97545a2 100644
// NOTE: this class may be used from within tcmalloc, and can not
// use any memory allocation routines.
-@@ -125,7 +125,7 @@ class VDSOSupport {
+@@ -130,7 +130,7 @@ class VDSOSupport {
DISALLOW_COPY_AND_ASSIGN(VDSOSupport);
};
@@ -861,10 +311,10 @@ index c1209a4..97545a2 100644
#endif // HAVE_ELF_MEM_IMAGE
diff --git a/src/central_freelist.h b/src/central_freelist.h
-index 4148680..02bbaa0 100644
+index ceba600..03cf7f4 100644
--- a/src/central_freelist.h
+++ b/src/central_freelist.h
-@@ -52,7 +52,7 @@ class CentralFreeList {
+@@ -50,7 +50,7 @@ class CentralFreeList {
// A CentralFreeList may be used before its constructor runs.
// So we prevent lock_'s constructor from doing anything to the
// lock_ state.
@@ -874,7 +324,7 @@ index 4148680..02bbaa0 100644
void Init(size_t cl);
diff --git a/src/emergency_malloc.cc b/src/emergency_malloc.cc
-index 81c5554..0860c85 100644
+index 6c0946a..9b41253 100644
--- a/src/emergency_malloc.cc
+++ b/src/emergency_malloc.cc
@@ -47,7 +47,7 @@ namespace tcmalloc {
@@ -887,7 +337,7 @@ index 81c5554..0860c85 100644
static LowLevelAlloc::Arena *emergency_arena;
diff --git a/src/gperftools/malloc_extension.h
b/src/gperftools/malloc_extension.h
-index 689b5f1..ec45fbd 100644
+index 271ef5d..20db658 100644
--- a/src/gperftools/malloc_extension.h
+++ b/src/gperftools/malloc_extension.h
@@ -67,7 +67,7 @@ static const int kMallocHistogramSize = 64;
@@ -899,7 +349,7 @@ index 689b5f1..ec45fbd 100644
struct MallocRange;
}
-@@ -144,7 +144,7 @@ class PERFTOOLS_DLL_DECL MallocExtension {
+@@ -148,7 +148,7 @@ class PERFTOOLS_DLL_DECL MallocExtension {
//
// This is a best-effort interface useful only for performance
// analysis. The implementation may not call func at all.
@@ -908,7 +358,7 @@ index 689b5f1..ec45fbd 100644
virtual void Ranges(void* arg, RangeFunction func);
// -------------------------------------------------------------------
-@@ -406,7 +406,7 @@ class PERFTOOLS_DLL_DECL MallocExtension {
+@@ -416,7 +416,7 @@ class PERFTOOLS_DLL_DECL MallocExtension {
virtual void MarkThreadTemporarilyIdle();
};
@@ -917,7 +367,7 @@ index 689b5f1..ec45fbd 100644
// Information passed per range. More fields may be added later.
struct MallocRange {
-@@ -429,6 +429,6 @@ struct MallocRange {
+@@ -439,6 +439,6 @@ struct MallocRange {
// - age when allocated (for inuse) or freed (if not in use)
};
@@ -926,20 +376,20 @@ index 689b5f1..ec45fbd 100644
#endif // BASE_MALLOC_EXTENSION_H_
diff --git a/src/heap-profile-table.cc b/src/heap-profile-table.cc
-index 7486468..6f6a1ee 100644
+index 455152e..c5dcd6e 100644
--- a/src/heap-profile-table.cc
+++ b/src/heap-profile-table.cc
-@@ -593,7 +593,7 @@ void HeapProfileTable::Snapshot::ReportLeaks(const char*
checker_name,
+@@ -590,7 +590,7 @@ void HeapProfileTable::Snapshot::ReportLeaks(const char*
checker_name,
symbolization_table.Symbolize();
for (int i = 0; i < to_report; i++) {
const Entry& e = entries[i];
- base::RawPrinter printer(buffer, kBufSize);
+ tcmalloc::RawPrinter printer(buffer, kBufSize);
- printer.Printf("Leak of %d bytes in %d objects allocated from:\n",
+ printer.Printf("Leak of %zu bytes in %d objects allocated from:\n",
e.bytes, e.count);
for (int j = 0; j < e.bucket->depth; j++) {
diff --git a/src/internal_logging.cc b/src/internal_logging.cc
-index 708fa65..0f3a7be 100644
+index ca1c86e..62db989 100644
--- a/src/internal_logging.cc
+++ b/src/internal_logging.cc
@@ -47,7 +47,7 @@
@@ -952,10 +402,10 @@ index 708fa65..0f3a7be 100644
static const int kStatsBufferSize = 16 << 10;
static char stats_buffer[kStatsBufferSize] = { 0 };
diff --git a/src/malloc_hook-inl.h b/src/malloc_hook-inl.h
-index 30375d6..1468566 100644
+index ddf6a5a..33997af 100644
--- a/src/malloc_hook-inl.h
+++ b/src/malloc_hook-inl.h
-@@ -46,7 +46,7 @@
+@@ -48,7 +48,7 @@
#include "common.h" // for UNLIKELY
@@ -964,25 +414,9 @@ index 30375d6..1468566 100644
// Capacity of 8 means that HookList is 9 words.
static const int kHookListCapacity = 8;
-@@ -80,13 +80,13 @@ struct PERFTOOLS_DLL_DECL HookList {
-
- // Fast inline implementation for fast path of Invoke*Hook.
- bool empty() const {
-- return base::subtle::NoBarrier_Load(&priv_end) == 0;
-+ return tcmalloc::subtle::NoBarrier_Load(&priv_end) == 0;
- }
-
- // Used purely to handle deprecated singular hooks
- T GetSingular() const {
- const AtomicWord *place = &priv_data[kHookListSingularIdx];
-- return bit_cast<T>(base::subtle::NoBarrier_Load(place));
-+ return bit_cast<T>(tcmalloc::subtle::NoBarrier_Load(place));
- }
-
- T ExchangeSingular(T new_val);
-@@ -115,33 +115,33 @@ ATTRIBUTE_VISIBILITY_HIDDEN extern
HookList<MallocHook::MremapHook> mremap_hooks
- ATTRIBUTE_VISIBILITY_HIDDEN extern HookList<MallocHook::PreSbrkHook>
presbrk_hooks_;
- ATTRIBUTE_VISIBILITY_HIDDEN extern HookList<MallocHook::SbrkHook> sbrk_hooks_;
+@@ -121,26 +121,26 @@ struct PERFTOOLS_DLL_DECL HookList {
+ ATTRIBUTE_VISIBILITY_HIDDEN extern HookList<MallocHook::NewHook> new_hooks_;
+ ATTRIBUTE_VISIBILITY_HIDDEN extern HookList<MallocHook::DeleteHook>
delete_hooks_;
-} } // namespace base::internal
+} } // namespace tcmalloc::internal
@@ -1012,123 +446,13 @@ index 30375d6..1468566 100644
InvokeDeleteHookSlow(p);
}
}
-
- // The following method is DEPRECATED
- inline MallocHook::PreMmapHook MallocHook::GetPreMmapHook() {
-- return base::internal::premmap_hooks_.GetSingular();
-+ return tcmalloc::internal::premmap_hooks_.GetSingular();
- }
-
- inline void MallocHook::InvokePreMmapHook(const void* start,
-@@ -150,14 +150,14 @@ inline void MallocHook::InvokePreMmapHook(const void*
start,
- int flags,
- int fd,
- off_t offset) {
-- if (!base::internal::premmap_hooks_.empty()) {
-+ if (!tcmalloc::internal::premmap_hooks_.empty()) {
- InvokePreMmapHookSlow(start, size, protection, flags, fd, offset);
- }
- }
-
- // The following method is DEPRECATED
- inline MallocHook::MmapHook MallocHook::GetMmapHook() {
-- return base::internal::mmap_hooks_.GetSingular();
-+ return tcmalloc::internal::mmap_hooks_.GetSingular();
- }
-
- inline void MallocHook::InvokeMmapHook(const void* result,
-@@ -167,7 +167,7 @@ inline void MallocHook::InvokeMmapHook(const void* result,
- int flags,
- int fd,
- off_t offset) {
-- if (!base::internal::mmap_hooks_.empty()) {
-+ if (!tcmalloc::internal::mmap_hooks_.empty()) {
- InvokeMmapHookSlow(result, start, size, protection, flags, fd, offset);
- }
- }
-@@ -179,7 +179,7 @@ inline bool MallocHook::InvokeMmapReplacement(const void*
start,
- int fd,
- off_t offset,
- void** result) {
-- if (!base::internal::mmap_replacement_.empty()) {
-+ if (!tcmalloc::internal::mmap_replacement_.empty()) {
- return InvokeMmapReplacementSlow(start, size,
- protection, flags,
- fd, offset,
-@@ -190,18 +190,18 @@ inline bool MallocHook::InvokeMmapReplacement(const
void* start,
-
- // The following method is DEPRECATED
- inline MallocHook::MunmapHook MallocHook::GetMunmapHook() {
-- return base::internal::munmap_hooks_.GetSingular();
-+ return tcmalloc::internal::munmap_hooks_.GetSingular();
- }
-
- inline void MallocHook::InvokeMunmapHook(const void* p, size_t size) {
-- if (!base::internal::munmap_hooks_.empty()) {
-+ if (!tcmalloc::internal::munmap_hooks_.empty()) {
- InvokeMunmapHookSlow(p, size);
- }
- }
-
- inline bool MallocHook::InvokeMunmapReplacement(
- const void* p, size_t size, int* result) {
-- if (!base::internal::mmap_replacement_.empty()) {
-+ if (!tcmalloc::internal::mmap_replacement_.empty()) {
- return InvokeMunmapReplacementSlow(p, size, result);
- }
- return false;
-@@ -209,7 +209,7 @@ inline bool MallocHook::InvokeMunmapReplacement(
-
- // The following method is DEPRECATED
- inline MallocHook::MremapHook MallocHook::GetMremapHook() {
-- return base::internal::mremap_hooks_.GetSingular();
-+ return tcmalloc::internal::mremap_hooks_.GetSingular();
- }
-
- inline void MallocHook::InvokeMremapHook(const void* result,
-@@ -218,30 +218,30 @@ inline void MallocHook::InvokeMremapHook(const void*
result,
- size_t new_size,
- int flags,
- const void* new_addr) {
-- if (!base::internal::mremap_hooks_.empty()) {
-+ if (!tcmalloc::internal::mremap_hooks_.empty()) {
- InvokeMremapHookSlow(result, old_addr, old_size, new_size, flags,
new_addr);
- }
- }
-
- // The following method is DEPRECATED
- inline MallocHook::PreSbrkHook MallocHook::GetPreSbrkHook() {
-- return base::internal::presbrk_hooks_.GetSingular();
-+ return tcmalloc::internal::presbrk_hooks_.GetSingular();
- }
-
- inline void MallocHook::InvokePreSbrkHook(ptrdiff_t increment) {
-- if (!base::internal::presbrk_hooks_.empty() && increment != 0) {
-+ if (!tcmalloc::internal::presbrk_hooks_.empty() && increment != 0) {
- InvokePreSbrkHookSlow(increment);
- }
- }
-
- // The following method is DEPRECATED
- inline MallocHook::SbrkHook MallocHook::GetSbrkHook() {
-- return base::internal::sbrk_hooks_.GetSingular();
-+ return tcmalloc::internal::sbrk_hooks_.GetSingular();
- }
-
- inline void MallocHook::InvokeSbrkHook(const void* result,
- ptrdiff_t increment) {
-- if (!base::internal::sbrk_hooks_.empty() && increment != 0) {
-+ if (!tcmalloc::internal::sbrk_hooks_.empty() && increment != 0) {
- InvokeSbrkHookSlow(result, increment);
- }
- }
diff --git a/src/malloc_hook.cc b/src/malloc_hook.cc
-index 64c2165..1b0dcd0 100644
+index 79917b6..ae8fc62 100644
--- a/src/malloc_hook.cc
+++ b/src/malloc_hook.cc
-@@ -157,13 +157,13 @@ extern "C" void
MallocHook_InitAtFirstAllocation_HeapLeakChecker() {
- // Do nothing.
- }
+@@ -142,13 +142,13 @@ bool RemoveInitialHooksAndCallInitializers() {
+
+ } // namespace
-namespace base { namespace internal {
+namespace tcmalloc { namespace internal {
@@ -1141,136 +465,59 @@ index 64c2165..1b0dcd0 100644
+static SpinLock hooklist_spinlock(tcmalloc::LINKER_INITIALIZED);
template <typename T>
- bool HookList<T>::Add(T value_as_t) {
-@@ -175,28 +175,28 @@ bool HookList<T>::Add(T value_as_t) {
- // Find the first slot in data that is 0.
- int index = 0;
- while ((index < kHookListMaxValues) &&
-- (base::subtle::NoBarrier_Load(&priv_data[index]) != 0)) {
-+ (tcmalloc::subtle::NoBarrier_Load(&priv_data[index]) != 0)) {
- ++index;
- }
- if (index == kHookListMaxValues) {
- return false;
- }
-- AtomicWord prev_num_hooks = base::subtle::Acquire_Load(&priv_end);
-- base::subtle::NoBarrier_Store(&priv_data[index], value);
-+ AtomicWord prev_num_hooks = tcmalloc::subtle::Acquire_Load(&priv_end);
-+ tcmalloc::subtle::NoBarrier_Store(&priv_data[index], value);
- if (prev_num_hooks <= index) {
-- base::subtle::NoBarrier_Store(&priv_end, index + 1);
-+ tcmalloc::subtle::NoBarrier_Store(&priv_end, index + 1);
- }
- return true;
- }
-
- template <typename T>
- void HookList<T>::FixupPrivEndLocked() {
-- AtomicWord hooks_end = base::subtle::NoBarrier_Load(&priv_end);
-+ AtomicWord hooks_end = tcmalloc::subtle::NoBarrier_Load(&priv_end);
- while ((hooks_end > 0) &&
-- (base::subtle::NoBarrier_Load(&priv_data[hooks_end - 1]) == 0)) {
-+ (tcmalloc::subtle::NoBarrier_Load(&priv_data[hooks_end - 1]) == 0)) {
- --hooks_end;
- }
-- base::subtle::NoBarrier_Store(&priv_end, hooks_end);
-+ tcmalloc::subtle::NoBarrier_Store(&priv_end, hooks_end);
- }
-
- template <typename T>
-@@ -205,26 +205,26 @@ bool HookList<T>::Remove(T value_as_t) {
- return false;
- }
- SpinLockHolder l(&hooklist_spinlock);
-- AtomicWord hooks_end = base::subtle::NoBarrier_Load(&priv_end);
-+ AtomicWord hooks_end = tcmalloc::subtle::NoBarrier_Load(&priv_end);
- int index = 0;
- while (index < hooks_end && value_as_t != bit_cast<T>(
-- base::subtle::NoBarrier_Load(&priv_data[index]))) {
-+ tcmalloc::subtle::NoBarrier_Load(&priv_data[index]))) {
- ++index;
- }
- if (index == hooks_end) {
- return false;
- }
-- base::subtle::NoBarrier_Store(&priv_data[index], 0);
-+ tcmalloc::subtle::NoBarrier_Store(&priv_data[index], 0);
- FixupPrivEndLocked();
- return true;
- }
-
- template <typename T>
- int HookList<T>::Traverse(T* output_array, int n) const {
-- AtomicWord hooks_end = base::subtle::Acquire_Load(&priv_end);
-+ AtomicWord hooks_end = tcmalloc::subtle::Acquire_Load(&priv_end);
- int actual_hooks_end = 0;
- for (int i = 0; i < hooks_end && n > 0; ++i) {
-- AtomicWord data = base::subtle::Acquire_Load(&priv_data[i]);
-+ AtomicWord data = tcmalloc::subtle::Acquire_Load(&priv_data[i]);
- if (data != 0) {
- *output_array++ = bit_cast<T>(data);
- ++actual_hooks_end;
-@@ -239,10 +239,10 @@ T HookList<T>::ExchangeSingular(T value_as_t) {
- AtomicWord value = bit_cast<AtomicWord>(value_as_t);
- AtomicWord old_value;
- SpinLockHolder l(&hooklist_spinlock);
-- old_value = base::subtle::NoBarrier_Load(&priv_data[kHookListSingularIdx]);
-- base::subtle::NoBarrier_Store(&priv_data[kHookListSingularIdx], value);
-+ old_value =
tcmalloc::subtle::NoBarrier_Load(&priv_data[kHookListSingularIdx]);
-+ tcmalloc::subtle::NoBarrier_Store(&priv_data[kHookListSingularIdx], value);
- if (value != 0) {
-- base::subtle::NoBarrier_Store(&priv_end, kHookListSingularIdx + 1);
-+ tcmalloc::subtle::NoBarrier_Store(&priv_end, kHookListSingularIdx + 1);
- } else {
- FixupPrivEndLocked();
- }
-@@ -277,19 +277,19 @@ HookList<MallocHook::MunmapReplacement>
munmap_replacement_ = { 0 };
- #undef INIT_HOOK_LIST_WITH_VALUE
- #undef INIT_HOOK_LIST
+ bool HookList<T>::Add(T value) {
+@@ -239,11 +239,11 @@ template struct HookList<MallocHook::NewHook>;
+ HookList<MallocHook::NewHook> new_hooks_{InitialNewHook};
+ HookList<MallocHook::DeleteHook> delete_hooks_;
-} } // namespace base::internal
--
++} } // namespace tcmalloc::internal
+
-using base::internal::kHookListMaxValues;
-using base::internal::new_hooks_;
-using base::internal::delete_hooks_;
--using base::internal::premmap_hooks_;
--using base::internal::mmap_hooks_;
--using base::internal::mmap_replacement_;
--using base::internal::munmap_hooks_;
--using base::internal::munmap_replacement_;
--using base::internal::mremap_hooks_;
--using base::internal::presbrk_hooks_;
--using base::internal::sbrk_hooks_;
-+} } // namespace tcmalloc::internal
-+
+using tcmalloc::internal::kHookListMaxValues;
+using tcmalloc::internal::new_hooks_;
+using tcmalloc::internal::delete_hooks_;
-+using tcmalloc::internal::premmap_hooks_;
-+using tcmalloc::internal::mmap_hooks_;
-+using tcmalloc::internal::mmap_replacement_;
-+using tcmalloc::internal::munmap_hooks_;
-+using tcmalloc::internal::munmap_replacement_;
-+using tcmalloc::internal::mremap_hooks_;
-+using tcmalloc::internal::presbrk_hooks_;
-+using tcmalloc::internal::sbrk_hooks_;
// These are available as C bindings as well as C++, hence their
// definition outside the MallocHook class.
+diff --git a/src/mmap_hook.cc b/src/mmap_hook.cc
+index 0b9aa08..9fa9bab 100644
+--- a/src/mmap_hook.cc
++++ b/src/mmap_hook.cc
+@@ -83,7 +83,7 @@ static_assert(alignof(MappingHookDescriptor) ==
alignof(MappingHookSpace), "");
+
+ class MappingHooks {
+ public:
+- MappingHooks(base::LinkerInitialized) {}
++ MappingHooks(tcmalloc::LinkerInitialized) {}
+
+ static MappingHookDescriptor* SpaceToDesc(MappingHookSpace* space) {
+ return reinterpret_cast<MappingHookDescriptor*>(space->storage);
+@@ -148,7 +148,7 @@ public:
+ private:
+ std::atomic<MappingHookDescriptor*> list_head_;
+ std::atomic<bool> ran_initial_hooks_;
+-} mapping_hooks{base::LINKER_INITIALIZED};
++} mapping_hooks{tcmalloc::LINKER_INITIALIZED};
+
+ } // namespace
+
diff --git a/src/page_heap.cc b/src/page_heap.cc
-index 7dd5646..673cfa6 100644
+index 386a0ec..6e4aed4 100644
--- a/src/page_heap.cc
+++ b/src/page_heap.cc
-@@ -582,7 +582,7 @@ void PageHeap::GetLargeSpanStats(LargeSpanStats* result) {
+@@ -691,7 +691,7 @@ void PageHeap::GetLargeSpanStatsLocked(LargeSpanStats*
result) {
}
}
-bool PageHeap::GetNextRange(PageID start, base::MallocRange* r) {
+bool PageHeap::GetNextRange(PageID start, tcmalloc::MallocRange* r) {
+ ASSERT(lock_.IsHeld());
Span* span = reinterpret_cast<Span*>(pagemap_.Next(start));
if (span == NULL) {
- return false;
-@@ -592,7 +592,7 @@ bool PageHeap::GetNextRange(PageID start,
base::MallocRange* r) {
+@@ -702,7 +702,7 @@ bool PageHeap::GetNextRange(PageID start,
base::MallocRange* r) {
r->fraction = 0;
switch (span->location) {
case Span::IN_USE:
@@ -1279,7 +526,7 @@ index 7dd5646..673cfa6 100644
r->fraction = 1;
if (span->sizeclass > 0) {
// Only some of the objects in this span may be in use.
-@@ -601,13 +601,13 @@ bool PageHeap::GetNextRange(PageID start,
base::MallocRange* r) {
+@@ -711,13 +711,13 @@ bool PageHeap::GetNextRange(PageID start,
base::MallocRange* r) {
}
break;
case Span::ON_NORMAL_FREELIST:
@@ -1297,7 +544,7 @@ index 7dd5646..673cfa6 100644
}
return true;
diff --git a/src/page_heap.h b/src/page_heap.h
-index bf50394..ec487bc 100644
+index 12b447f..9c135fd 100644
--- a/src/page_heap.h
+++ b/src/page_heap.h
@@ -65,7 +65,7 @@
@@ -1309,7 +556,7 @@ index bf50394..ec487bc 100644
struct MallocRange;
}
-@@ -150,7 +150,7 @@ class PERFTOOLS_DLL_DECL PageHeap {
+@@ -168,7 +168,7 @@ class PERFTOOLS_DLL_DECL PageHeap {
// If this page heap is managing a range with starting page # >= start,
// store info about the range in *r and return true. Else return false.
@@ -1341,7 +588,7 @@ index 3fecabd..9a2f791 100644
} // namespace tcmalloc
diff --git a/src/raw_printer.cc b/src/raw_printer.cc
-index 3cf028e..cdcf8a1 100644
+index 785d473..7b38b88 100644
--- a/src/raw_printer.cc
+++ b/src/raw_printer.cc
@@ -37,7 +37,7 @@
@@ -1354,7 +601,7 @@ index 3cf028e..cdcf8a1 100644
RawPrinter::RawPrinter(char* buf, int length)
: base_(buf),
diff --git a/src/raw_printer.h b/src/raw_printer.h
-index 9288bb5..b40c013 100644
+index 5f57bbf..860dca9 100644
--- a/src/raw_printer.h
+++ b/src/raw_printer.h
@@ -46,7 +46,7 @@
@@ -1367,7 +614,7 @@ index 9288bb5..b40c013 100644
class RawPrinter {
public:
diff --git a/src/stacktrace_powerpc-linux-inl.h
b/src/stacktrace_powerpc-linux-inl.h
-index a301a46..617fc05 100644
+index 883e7d2..139f8dd 100644
--- a/src/stacktrace_powerpc-linux-inl.h
+++ b/src/stacktrace_powerpc-linux-inl.h
@@ -149,8 +149,8 @@ static int GET_STACK_TRACE_OR_FRAMES {
@@ -1381,29 +628,11 @@ index a301a46..617fc05 100644
#ifdef __PPC64__
const void *sigtramp64_vdso = 0;
if (vdso.LookupSymbol("__kernel_sigtramp_rt64", "LINUX_2.6.15", STT_NOTYPE,
-diff --git a/src/stacktrace_x86-inl.h b/src/stacktrace_x86-inl.h
-index 46eb5d8..ae3287b 100644
---- a/src/stacktrace_x86-inl.h
-+++ b/src/stacktrace_x86-inl.h
-@@ -154,10 +154,10 @@ static void **NextStackFrame(void **old_sp, const void
*uc) {
- static const unsigned char *kernel_rt_sigreturn_address = NULL;
- static const unsigned char *kernel_vsyscall_address = NULL;
- if (num_push_instructions == -1) {
-- base::VDSOSupport vdso;
-+ tcmalloc::VDSOSupport vdso;
- if (vdso.IsPresent()) {
-- base::VDSOSupport::SymbolInfo rt_sigreturn_symbol_info;
-- base::VDSOSupport::SymbolInfo vsyscall_symbol_info;
-+ tcmalloc::VDSOSupport::SymbolInfo rt_sigreturn_symbol_info;
-+ tcmalloc::VDSOSupport::SymbolInfo vsyscall_symbol_info;
- if (!vdso.LookupSymbol("__kernel_rt_sigreturn", "LINUX_2.5",
- STT_FUNC, &rt_sigreturn_symbol_info) ||
- !vdso.LookupSymbol("__kernel_vsyscall", "LINUX_2.5",
diff --git a/src/tcmalloc.cc b/src/tcmalloc.cc
-index 1f22dfb..a8fc5ee 100644
+index 47c6a61..d863c14 100644
--- a/src/tcmalloc.cc
+++ b/src/tcmalloc.cc
-@@ -590,7 +590,7 @@ static void IterateOverRanges(void* arg,
MallocExtension::RangeFunction func) {
+@@ -566,7 +566,7 @@ static void IterateOverRanges(void* arg,
MallocExtension::RangeFunction func) {
while (!done) {
// Accumulate a small number of ranges in a local buffer
static const int kNumRanges = 16;
@@ -1412,7 +641,7 @@ index 1f22dfb..a8fc5ee 100644
int n = 0;
{
SpinLockHolder h(Static::pageheap_lock());
-@@ -1824,7 +1824,7 @@ void* memalign_pages(size_t align, size_t size,
+@@ -1877,7 +1877,7 @@ void* memalign_pages(size_t align, size_t size,
template <void* OOMHandler(size_t)>
ATTRIBUTE_ALWAYS_INLINE inline
static void * malloc_fast_path(size_t size) {
@@ -1421,7 +650,7 @@ index 1f22dfb..a8fc5ee 100644
return tcmalloc::dispatch_allocate_full<OOMHandler>(size);
}
-@@ -1875,7 +1875,7 @@ void* tc_malloc(size_t size) PERFTOOLS_NOTHROW {
+@@ -1928,7 +1928,7 @@ void* tc_malloc(size_t size) PERFTOOLS_NOTHROW {
static ATTRIBUTE_ALWAYS_INLINE inline
void free_fast_path(void *ptr) {
@@ -1430,7 +659,7 @@ index 1f22dfb..a8fc5ee 100644
tcmalloc::invoke_hooks_and_free(ptr);
return;
}
-@@ -1889,7 +1889,7 @@ void tc_free(void* ptr) PERFTOOLS_NOTHROW {
+@@ -1942,7 +1942,7 @@ void tc_free(void* ptr) PERFTOOLS_NOTHROW {
extern "C" PERFTOOLS_DLL_DECL CACHELINE_ALIGNED_FN
void tc_free_sized(void *ptr, size_t size) PERFTOOLS_NOTHROW {
@@ -1439,96 +668,36 @@ index 1f22dfb..a8fc5ee 100644
tcmalloc::invoke_hooks_and_free(ptr);
return;
}
-@@ -1991,7 +1991,7 @@ extern "C" PERFTOOLS_DLL_DECL void
tc_delete_nothrow(void* p, const std::nothrow
- TC_ALIAS(tc_free);
- #else
+@@ -2041,7 +2041,7 @@ TC_ALIAS(tc_free);
+ // But it's really the same as normal delete, so we just do the same thing.
+ extern "C" PERFTOOLS_DLL_DECL void tc_delete_nothrow(void* p, const
std::nothrow_t&) PERFTOOLS_NOTHROW
{
- if (PREDICT_FALSE(!base::internal::delete_hooks_.empty())) {
+ if (PREDICT_FALSE(!tcmalloc::internal::delete_hooks_.empty())) {
tcmalloc::invoke_hooks_and_free(p);
return;
}
-diff --git a/src/tests/atomicops_unittest.cc b/src/tests/atomicops_unittest.cc
-index aa82a6b..3caa9f2 100644
---- a/src/tests/atomicops_unittest.cc
-+++ b/src/tests/atomicops_unittest.cc
-@@ -99,19 +99,19 @@ static void TestStore() {
-
- AtomicType value;
-
-- base::subtle::NoBarrier_Store(&value, kVal1);
-+ tcmalloc::subtle::NoBarrier_Store(&value, kVal1);
- ASSERT_EQ(kVal1, value);
-- base::subtle::NoBarrier_Store(&value, kVal2);
-+ tcmalloc::subtle::NoBarrier_Store(&value, kVal2);
- ASSERT_EQ(kVal2, value);
-
-- base::subtle::Acquire_Store(&value, kVal1);
-+ tcmalloc::subtle::Acquire_Store(&value, kVal1);
- ASSERT_EQ(kVal1, value);
-- base::subtle::Acquire_Store(&value, kVal2);
-+ tcmalloc::subtle::Acquire_Store(&value, kVal2);
- ASSERT_EQ(kVal2, value);
-
-- base::subtle::Release_Store(&value, kVal1);
-+ tcmalloc::subtle::Release_Store(&value, kVal1);
- ASSERT_EQ(kVal1, value);
-- base::subtle::Release_Store(&value, kVal2);
-+ tcmalloc::subtle::Release_Store(&value, kVal2);
- ASSERT_EQ(kVal2, value);
- }
-
-@@ -125,30 +125,30 @@ static void TestLoad() {
- AtomicType value;
-
- value = kVal1;
-- ASSERT_EQ(kVal1, base::subtle::NoBarrier_Load(&value));
-+ ASSERT_EQ(kVal1, tcmalloc::subtle::NoBarrier_Load(&value));
- value = kVal2;
-- ASSERT_EQ(kVal2, base::subtle::NoBarrier_Load(&value));
-+ ASSERT_EQ(kVal2, tcmalloc::subtle::NoBarrier_Load(&value));
-
- value = kVal1;
-- ASSERT_EQ(kVal1, base::subtle::Acquire_Load(&value));
-+ ASSERT_EQ(kVal1, tcmalloc::subtle::Acquire_Load(&value));
- value = kVal2;
-- ASSERT_EQ(kVal2, base::subtle::Acquire_Load(&value));
-+ ASSERT_EQ(kVal2, tcmalloc::subtle::Acquire_Load(&value));
-
- value = kVal1;
-- ASSERT_EQ(kVal1, base::subtle::Release_Load(&value));
-+ ASSERT_EQ(kVal1, tcmalloc::subtle::Release_Load(&value));
- value = kVal2;
-- ASSERT_EQ(kVal2, base::subtle::Release_Load(&value));
-+ ASSERT_EQ(kVal2, tcmalloc::subtle::Release_Load(&value));
- }
-
- template <class AtomicType>
- static void TestAtomicOps() {
-- TestCompareAndSwap<AtomicType>(base::subtle::NoBarrier_CompareAndSwap);
-- TestCompareAndSwap<AtomicType>(base::subtle::Acquire_CompareAndSwap);
-- TestCompareAndSwap<AtomicType>(base::subtle::Release_CompareAndSwap);
-+ TestCompareAndSwap<AtomicType>(tcmalloc::subtle::NoBarrier_CompareAndSwap);
-+ TestCompareAndSwap<AtomicType>(tcmalloc::subtle::Acquire_CompareAndSwap);
-+ TestCompareAndSwap<AtomicType>(tcmalloc::subtle::Release_CompareAndSwap);
-
-- TestAtomicExchange<AtomicType>(base::subtle::NoBarrier_AtomicExchange);
-- TestAtomicExchange<AtomicType>(base::subtle::Acquire_AtomicExchange);
-- TestAtomicExchange<AtomicType>(base::subtle::Release_AtomicExchange);
-+ TestAtomicExchange<AtomicType>(tcmalloc::subtle::NoBarrier_AtomicExchange);
-+ TestAtomicExchange<AtomicType>(tcmalloc::subtle::Acquire_AtomicExchange);
-+ TestAtomicExchange<AtomicType>(tcmalloc::subtle::Release_AtomicExchange);
-
- TestStore<AtomicType>();
- TestLoad<AtomicType>();
+diff --git a/src/tests/heap-checker_unittest.cc
b/src/tests/heap-checker_unittest.cc
+index 9a7086c..f93d6ea 100644
+--- a/src/tests/heap-checker_unittest.cc
++++ b/src/tests/heap-checker_unittest.cc
+@@ -801,7 +801,7 @@ static void DirectTestSTLAlloc(Alloc allocator, const
char* name) {
+ CHECK(check.BriefSameHeap()); // just in case
+ }
+
+-static SpinLock grplock{base::LINKER_INITIALIZED};
++static SpinLock grplock{tcmalloc::LINKER_INITIALIZED};
+ static struct group* grp = NULL;
+ static const int kKeys = 50;
+ static pthread_key_t key[kKeys];
diff --git a/src/tests/malloc_hook_test.cc b/src/tests/malloc_hook_test.cc
-index a5cd860..84fecca 100644
+index a128355..af9b842 100644
--- a/src/tests/malloc_hook_test.cc
+++ b/src/tests/malloc_hook_test.cc
-@@ -91,12 +91,12 @@ void Sleep(int seconds) {
+@@ -87,12 +87,12 @@ void Sleep(int seconds) {
+ #endif
}
- using std::min;
-using base::internal::kHookListMaxValues;
+using tcmalloc::internal::kHookListMaxValues;
@@ -1538,8 +707,8 @@ index a5cd860..84fecca 100644
-typedef base::internal::HookList<MallocHook::NewHook> TestHookList;
+typedef tcmalloc::internal::HookList<MallocHook::NewHook> TestHookList;
- int TestHookList_Traverse(const TestHookList& list, uintptr_t* output_array,
int n) {
- MallocHook::NewHook values_as_hooks[kHookListMaxValues];
+
+ const MallocHook::NewHook kTestValue =
reinterpret_cast<MallocHook::NewHook>(69);
diff --git a/src/tests/raw_printer_test.cc b/src/tests/raw_printer_test.cc
index 2c7be6a..99a2f13 100644
--- a/src/tests/raw_printer_test.cc
@@ -1581,10 +750,10 @@ index 2c7be6a..99a2f13 100644
CHECK_EQ(string("hello world"), string(buffer));
CHECK_EQ(11, printer.length());
diff --git a/src/tests/tcmalloc_unittest.cc b/src/tests/tcmalloc_unittest.cc
-index a9c6429..9149fde 100644
+index 707840a..a199901 100644
--- a/src/tests/tcmalloc_unittest.cc
+++ b/src/tests/tcmalloc_unittest.cc
-@@ -853,21 +853,21 @@ namespace {
+@@ -829,21 +829,21 @@ namespace {
struct RangeCallbackState {
uintptr_t ptr;
@@ -1611,7 +780,7 @@ index a9c6429..9149fde 100644
} else {
CHECK_EQ(r->type, state->expected_type);
}
-@@ -879,7 +879,7 @@ static void RangeCallback(void* arg, const
base::MallocRange* r) {
+@@ -855,7 +855,7 @@ static void RangeCallback(void* arg, const
base::MallocRange* r) {
// Check that at least one of the callbacks from Ranges() contains
// the specified address with the specified type, and has size
// >= min_size.
@@ -1620,20 +789,20 @@ index a9c6429..9149fde 100644
size_t min_size) {
RangeCallbackState state;
state.ptr = reinterpret_cast<uintptr_t>(ptr);
-@@ -899,20 +899,20 @@ static void TestRanges() {
+@@ -881,20 +881,20 @@ static void TestRanges() {
static const int MB = 1048576;
void* a = malloc(MB);
void* b = malloc(MB);
- base::MallocRange::Type releasedType =
-- HaveSystemRelease ? base::MallocRange::UNMAPPED :
base::MallocRange::FREE;
+- HaveSystemRelease() ? base::MallocRange::UNMAPPED :
base::MallocRange::FREE;
+ tcmalloc::MallocRange::Type releasedType =
-+ HaveSystemRelease ? tcmalloc::MallocRange::UNMAPPED :
tcmalloc::MallocRange::FREE;
++ HaveSystemRelease() ? tcmalloc::MallocRange::UNMAPPED :
tcmalloc::MallocRange::FREE;
- CheckRangeCallback(a, base::MallocRange::INUSE, MB);
- CheckRangeCallback(b, base::MallocRange::INUSE, MB);
+ CheckRangeCallback(a, tcmalloc::MallocRange::INUSE, MB);
+ CheckRangeCallback(b, tcmalloc::MallocRange::INUSE, MB);
- free(a);
+ (noopt(free))(a);
- CheckRangeCallback(a, base::MallocRange::FREE, MB);
- CheckRangeCallback(b, base::MallocRange::INUSE, MB);
+ CheckRangeCallback(a, tcmalloc::MallocRange::FREE, MB);
@@ -1642,7 +811,7 @@ index a9c6429..9149fde 100644
CheckRangeCallback(a, releasedType, MB);
- CheckRangeCallback(b, base::MallocRange::INUSE, MB);
+ CheckRangeCallback(b, tcmalloc::MallocRange::INUSE, MB);
- free(b);
+ (noopt(free))(b);
CheckRangeCallback(a, releasedType, MB);
- CheckRangeCallback(b, base::MallocRange::FREE, MB);
+ CheckRangeCallback(b, tcmalloc::MallocRange::FREE, MB);
diff --git a/thirdparty/patches/gperftools-tcmalloc-osx-fix.patch
b/thirdparty/patches/gperftools-tcmalloc-osx-fix.patch
deleted file mode 100644
index 04a1085bd..000000000
--- a/thirdparty/patches/gperftools-tcmalloc-osx-fix.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From 852fb6df031560c5e353b497222b76394190e27d Mon Sep 17 00:00:00 2001
-From: Natale Patriciello <[email protected]>
-Date: Thu, 18 Nov 2021 18:16:40 +0100
-Subject: [PATCH] Implement free_definite_size
-
-In Monterey, it seems that free_definite_size is required (despite
-the documentation saying that is optional). The implementation
-just forward the call to free.
-
-Signed-off-by: Natale Patriciello <[email protected]>
----
- src/libc_override_osx.h | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/src/libc_override_osx.h b/src/libc_override_osx.h
-index 9d5d611..a4c1dde 100644
---- a/src/libc_override_osx.h
-+++ b/src/libc_override_osx.h
-@@ -129,6 +129,10 @@ void mz_free(malloc_zone_t* zone, void* ptr) {
- return tc_free(ptr);
- }
-
-+void mz_free_definite_size(malloc_zone_t* zone, void *ptr, size_t size) {
-+ return tc_free(ptr);
-+}
-+
- void* mz_realloc(malloc_zone_t* zone, void* ptr, size_t size) {
- return tc_realloc(ptr, size);
- }
-@@ -272,7 +276,7 @@ static void ReplaceSystemAlloc() {
- MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
- // Switch to version 6 on OSX 10.6 to support memalign.
- tcmalloc_zone.version = 6;
-- tcmalloc_zone.free_definite_size = NULL;
-+ tcmalloc_zone.free_definite_size = &mz_free_definite_size;
- tcmalloc_zone.memalign = &mz_memalign;
- tcmalloc_introspection.zone_locked = &mi_zone_locked;
-
---
-2.30.2
-
diff --git a/thirdparty/vars.sh b/thirdparty/vars.sh
index 4312c042a..b1fed79a9 100644
--- a/thirdparty/vars.sh
+++ b/thirdparty/vars.sh
@@ -50,7 +50,7 @@ GMOCK_VERSION=1.12.1
GMOCK_NAME=googletest-release-$GMOCK_VERSION
GMOCK_SOURCE=$TP_SOURCE_DIR/$GMOCK_NAME
-GPERFTOOLS_VERSION=2.8.1
+GPERFTOOLS_VERSION=2.13
GPERFTOOLS_NAME=gperftools-$GPERFTOOLS_VERSION
GPERFTOOLS_SOURCE=$TP_SOURCE_DIR/$GPERFTOOLS_NAME