Index: third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h |
diff --git a/third_party/tcmalloc/chromium/src/google/malloc_extension.h b/third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h |
similarity index 94% |
copy from third_party/tcmalloc/chromium/src/google/malloc_extension.h |
copy to third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h |
index 0e15c04ba7b75930592d5c6d362581ec55acd10e..5bee01984e1e1dec9ab3a65d75aec19d75a2d50d 100644 |
--- a/third_party/tcmalloc/chromium/src/google/malloc_extension.h |
+++ b/third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h |
@@ -81,9 +81,6 @@ class SysAllocator { |
// Returns NULL if failed. Otherwise, the returned pointer p up to and |
// including (p + actual_size -1) have been allocated. |
virtual void* Alloc(size_t size, size_t *actual_size, size_t alignment) = 0; |
- |
- // Notification that command-line flags have been initialized. |
- virtual void FlagsInitialized() = 0; |
}; |
// The default implementations of the following routines do nothing. |
@@ -103,9 +100,9 @@ class PERFTOOLS_DLL_DECL MallocExtension { |
// See "verify_memory.h" to see what these routines do |
virtual bool VerifyAllMemory(); |
- virtual bool VerifyNewMemory(void* p); |
- virtual bool VerifyArrayNewMemory(void* p); |
- virtual bool VerifyMallocMemory(void* p); |
+ virtual bool VerifyNewMemory(const void* p); |
+ virtual bool VerifyArrayNewMemory(const void* p); |
+ virtual bool VerifyMallocMemory(const void* p); |
virtual bool MallocMemoryStats(int* blocks, size_t* total, |
int histogram[kMallocHistogramSize]); |
@@ -283,7 +280,25 @@ class PERFTOOLS_DLL_DECL MallocExtension { |
// will return 0.) |
// This is equivalent to malloc_size() in OS X, malloc_usable_size() |
// in glibc, and _msize() for windows. |
- virtual size_t GetAllocatedSize(void* p); |
+ virtual size_t GetAllocatedSize(const void* p); |
+ |
+ // Returns kOwned if this malloc implementation allocated the memory |
+ // pointed to by p, or kNotOwned if some other malloc implementation |
+ // allocated it or p is NULL. May also return kUnknownOwnership if |
+ // the malloc implementation does not keep track of ownership. |
+ // REQUIRES: p must be a value returned from a previous call to |
+ // malloc(), calloc(), realloc(), memalign(), posix_memalign(), |
+ // valloc(), pvalloc(), new, or new[], and must refer to memory that |
+ // is currently allocated (so, for instance, you should not pass in |
+ // a pointer after having called free() on it). |
+ enum Ownership { |
+ // NOTE: Enum values MUST be kept in sync with the version in |
+ // malloc_extension_c.h |
+ kUnknownOwnership = 0, |
+ kOwned, |
+ kNotOwned |
+ }; |
+ virtual Ownership GetOwnership(const void* p); |
// The current malloc implementation. Always non-NULL. |
static MallocExtension* instance(); |