Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(711)

Unified Diff: third_party/tcmalloc/chromium/src/tcmalloc.cc

Issue 2830035: tc_malloc_usable_size impl (Closed)
Patch Set: ok Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/tcmalloc/chromium/src/tcmalloc.cc
diff --git a/third_party/tcmalloc/chromium/src/tcmalloc.cc b/third_party/tcmalloc/chromium/src/tcmalloc.cc
index 8bc225392419fc73ff6feea013786e36049099ec..794af94a8801bab0efa5d080491886ccb3d2a4c1 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,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698