diff options
author | cevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-22 06:04:16 +0000 |
---|---|---|
committer | cevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-22 06:04:16 +0000 |
commit | 7f29890728737bd2d8bb7941c5da6887d4e8cac8 (patch) | |
tree | 0ba25bfed477335fb2fbba3a7dcb05e2d04f7f08 /third_party/tcmalloc | |
parent | 7c1c84c887c0223ebe80f511403037a870fd29e9 (diff) | |
download | chromium_src-7f29890728737bd2d8bb7941c5da6887d4e8cac8.zip chromium_src-7f29890728737bd2d8bb7941c5da6887d4e8cac8.tar.gz chromium_src-7f29890728737bd2d8bb7941c5da6887d4e8cac8.tar.bz2 |
Trying to understand Linux x64 weirdness (to be reverted immediately).
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89989 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/tcmalloc')
-rw-r--r-- | third_party/tcmalloc/chromium/src/system-alloc.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/third_party/tcmalloc/chromium/src/system-alloc.cc b/third_party/tcmalloc/chromium/src/system-alloc.cc index 5053981..304afc7 100644 --- a/third_party/tcmalloc/chromium/src/system-alloc.cc +++ b/third_party/tcmalloc/chromium/src/system-alloc.cc @@ -186,6 +186,7 @@ static const char mmap_name[] = "MmapSysAllocator"; void* SbrkSysAllocator::Alloc(size_t size, size_t *actual_size, size_t alignment) { #ifndef HAVE_SBRK +TCMalloc_MESSAGE(__FILE__, __LINE__, "HAVE_SBRK\n"); return NULL; #else // Check if we should use sbrk allocation. @@ -195,12 +196,16 @@ void* SbrkSysAllocator::Alloc(size_t size, size_t *actual_size, // That means that even if this flag is set to true, some (initial) // memory will be allocated with sbrk before the flag takes effect. if (FLAGS_malloc_skip_sbrk) { +TCMalloc_MESSAGE(__FILE__, __LINE__, "malloc_skip_sbrk\n"); return NULL; } // sbrk will release memory if passed a negative number, so we do // a strict check here - if (static_cast<std::ptrdiff_t>(size + alignment) < 0) return NULL; + if (static_cast<std::ptrdiff_t>(size + alignment) < 0) { +TCMalloc_MESSAGE(__FILE__, __LINE__, "size + alignment\n"); +return NULL; +} // This doesn't overflow because TCMalloc_SystemAlloc has already // tested for overflow at the alignment boundary. @@ -220,11 +225,13 @@ void* SbrkSysAllocator::Alloc(size_t size, size_t *actual_size, // http://sourceware.org/cgi-bin/cvsweb.cgi/~checkout~/libc/misc/sbrk.c?rev=1.1.2.1&content-type=text/plain&cvsroot=glibc // Without this check, sbrk may succeed when it ought to fail.) if (reinterpret_cast<intptr_t>(sbrk(0)) + size < size) { +TCMalloc_MESSAGE(__FILE__, __LINE__, "vaddr wrap (curr %p)\n", sbrk(0)); return NULL; } void* result = sbrk(size); if (result == reinterpret_cast<void*>(-1)) { +TCMalloc_MESSAGE(__FILE__, __LINE__, "sbrk -1 (curr %p)\n", sbrk(0)); return NULL; } @@ -244,6 +251,7 @@ void* SbrkSysAllocator::Alloc(size_t size, size_t *actual_size, // that we can find an aligned region within it. result = sbrk(size + alignment - 1); if (result == reinterpret_cast<void*>(-1)) { +TCMalloc_MESSAGE(__FILE__, __LINE__, "sbrk -1 #2 (curr %p)\n", sbrk(0)); return NULL; } ptr = reinterpret_cast<uintptr_t>(result); |