summaryrefslogtreecommitdiffstats
path: root/third_party/tcmalloc/chromium
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-02 17:37:03 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-02 17:37:03 +0000
commit9d31dc62c63cdad2abb25ecef8753dbc65bd223a (patch)
treea2b0612af5033fadf6c61ea5db47b3224d8a651f /third_party/tcmalloc/chromium
parent65ccfa27c948c295e039480610192af60b3cb1ce (diff)
downloadchromium_src-9d31dc62c63cdad2abb25ecef8753dbc65bd223a.zip
chromium_src-9d31dc62c63cdad2abb25ecef8753dbc65bd223a.tar.gz
chromium_src-9d31dc62c63cdad2abb25ecef8753dbc65bd223a.tar.bz2
tcmalloc: also hook malloc_usable_size
The nvidia opengl driver uses this function. If we don't hook it with tcmalloc, then we mix calls to tcmalloc functions (malloc, free, etc) with the libc ones, causing our WebGL bits to hang. BUG=44590 Review URL: http://codereview.chromium.org/2830035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51539 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/tcmalloc/chromium')
-rw-r--r--third_party/tcmalloc/chromium/src/tcmalloc.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/third_party/tcmalloc/chromium/src/tcmalloc.cc b/third_party/tcmalloc/chromium/src/tcmalloc.cc
index 8bc2253..794af94 100644
--- a/third_party/tcmalloc/chromium/src/tcmalloc.cc
+++ b/third_party/tcmalloc/chromium/src/tcmalloc.cc
@@ -282,6 +282,7 @@ extern "C" {
#ifdef HAVE_STRUCT_MALLINFO
struct mallinfo mallinfo(void) __THROW ALIAS("tc_mallinfo");
#endif
+ size_t malloc_usable_size(void* ptr) __THROW ALIAS("tc_malloc_usable_size");
} // extern "C"
#else // #if defined(__GNUC__) && !defined(__MACH__)
// Portable wrappers
@@ -318,6 +319,9 @@ extern "C" {
#ifdef HAVE_STRUCT_MALLINFO
struct mallinfo mallinfo(void) __THROW { return tc_mallinfo(); }
#endif
+ size_t malloc_usable_size(void* p) __THROW {
+ return tc_malloc_usable_size(p);
+ }
} // extern "C"
#endif // #if defined(__GNUC__)
@@ -1525,6 +1529,10 @@ extern "C" PERFTOOLS_DLL_DECL struct mallinfo tc_mallinfo(void) __THROW {
}
#endif
+extern "C" PERFTOOLS_DLL_DECL size_t tc_malloc_usable_size(void* ptr) __THROW {
+ return GetSizeWithCallback(ptr, &InvalidGetAllocatedSize);
+}
+
// This function behaves similarly to MSVC's _set_new_mode.
// If flag is 0 (default), calls to malloc will behave normally.
// If flag is 1, calls to malloc will behave like calls to new,