diff options
Diffstat (limited to 'third_party/tcmalloc')
-rw-r--r-- | third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h | 6 | ||||
-rw-r--r-- | third_party/tcmalloc/chromium/src/malloc_extension.cc | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h b/third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h index 5bee019..950b603 100644 --- a/third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h +++ b/third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005, Google Inc. +// Copyright (c) 2012, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -307,6 +307,10 @@ class PERFTOOLS_DLL_DECL MallocExtension { // malloc implementation during initialization. static void Register(MallocExtension* implementation); + // On the current thread, return the total number of bytes allocated. + // (Currently only implemented in tcmalloc.) + static unsigned int GetBytesAllocatedOnCurrentThread(); + // Returns detailed information about malloc's freelists. For each list, // return a FreeListInfo: struct FreeListInfo { diff --git a/third_party/tcmalloc/chromium/src/malloc_extension.cc b/third_party/tcmalloc/chromium/src/malloc_extension.cc index 2d6497f..fb30d39 100644 --- a/third_party/tcmalloc/chromium/src/malloc_extension.cc +++ b/third_party/tcmalloc/chromium/src/malloc_extension.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2005, Google Inc. +// Copyright (c) 2012, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -50,6 +50,7 @@ #include "gperftools/malloc_extension.h" #include "gperftools/malloc_extension_c.h" #include "maybe_threads.h" +#include "thread_cache.h" using STL_NAMESPACE::string; using STL_NAMESPACE::vector; @@ -220,6 +221,10 @@ void MallocExtension::Register(MallocExtension* implementation) { } } +unsigned int MallocExtension::GetBytesAllocatedOnCurrentThread() { + return tcmalloc::ThreadCache::GetBytesAllocatedOnCurrentThread(); +} + // ----------------------------------------------------------------------- // Heap sampling support // ----------------------------------------------------------------------- |