diff options
-rw-r--r-- | base/allocator/allocator_shim.cc | 3 | ||||
-rw-r--r-- | third_party/tcmalloc/chromium/src/tcmalloc.cc | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/base/allocator/allocator_shim.cc b/base/allocator/allocator_shim.cc index 97946e7..33217ca 100644 --- a/base/allocator/allocator_shim.cc +++ b/base/allocator/allocator_shim.cc @@ -41,7 +41,8 @@ typedef enum { // See SetupSubprocessAllocator() to specify a default secondary (subprocess) // allocator. // TODO(jar): Switch to using TCMALLOC for the renderer as well. -static Allocator allocator = WINHEAP; +// static Allocator allocator = WINHEAP; +static Allocator allocator = TCMALLOC; // The names of the environment variables that can optionally control the // selection of the allocator. The primary may be used to control overall diff --git a/third_party/tcmalloc/chromium/src/tcmalloc.cc b/third_party/tcmalloc/chromium/src/tcmalloc.cc index e702256..629f4e0 100644 --- a/third_party/tcmalloc/chromium/src/tcmalloc.cc +++ b/third_party/tcmalloc/chromium/src/tcmalloc.cc @@ -1615,7 +1615,7 @@ void *(*__memalign_hook)(size_t, size_t, const void *) = MemalignOverride; // It will cost abotu 2% in performance, but it will catch double frees (most of // the time), and will often catch allocated-buffer overrun errors. This // validation is only active when TCMalloc is used as the allocator. -// #define TCMALLOC_VALIDATION +#define TCMALLOC_VALIDATION #if !defined(TCMALLOC_VALIDATION) @@ -1738,6 +1738,10 @@ static void ValidateAllocatedRegion(void* ptr, size_t cl) { if (current_mark != allocated_mark) DieFromMemoryCorruption(); *mark = ~allocated_mark; // Distinctively not allocated. + // Copy the mark into all the free'd region. + size_t class_size = static_cast<size_t>(reinterpret_cast<char*>(mark) - + reinterpret_cast<char*>(ptr)); + memset(ptr, static_cast<char>(0x36), class_size); } static void MarkAllocatedRegion(void* ptr) { |