summaryrefslogtreecommitdiffstats
path: root/third_party/tcmalloc/chromium/src/memfs_malloc.cc
diff options
context:
space:
mode:
authorglider@chromium.org <glider@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-18 10:25:57 +0000
committerglider@chromium.org <glider@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-18 10:25:57 +0000
commit3d8d7d46ac4f3ea7a14a742c52b705cdedc04ac7 (patch)
treed1c843a39bd423b24ef6d9b0aa7ffb500e352666 /third_party/tcmalloc/chromium/src/memfs_malloc.cc
parent2fbc71c029729406251fcde14ff1845d74dd974d (diff)
downloadchromium_src-3d8d7d46ac4f3ea7a14a742c52b705cdedc04ac7.zip
chromium_src-3d8d7d46ac4f3ea7a14a742c52b705cdedc04ac7.tar.gz
chromium_src-3d8d7d46ac4f3ea7a14a742c52b705cdedc04ac7.tar.bz2
Merged third_party/tcmalloc/vendor/src(google-perftools r87) into
third_party/tcmalloc/chromium/src. Review URL: http://codereview.chromium.org/576001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41938 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/tcmalloc/chromium/src/memfs_malloc.cc')
-rw-r--r--third_party/tcmalloc/chromium/src/memfs_malloc.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/third_party/tcmalloc/chromium/src/memfs_malloc.cc b/third_party/tcmalloc/chromium/src/memfs_malloc.cc
index bef2d3c..9df4cad 100644
--- a/third_party/tcmalloc/chromium/src/memfs_malloc.cc
+++ b/third_party/tcmalloc/chromium/src/memfs_malloc.cc
@@ -101,6 +101,11 @@ void HugetlbSysAllocator::DumpStats(TCMalloc_Printer* printer) {
void* HugetlbSysAllocator::Alloc(size_t size, size_t *actual_size,
size_t alignment) {
+ // don't go any further if we haven't opened the backing file
+ if (hugetlb_fd_ == -1) {
+ return NULL;
+ }
+
// We don't respond to allocation requests smaller than big_page_size_ unless
// the caller is willing to take more than they asked for.
if (actual_size == NULL && size < big_page_size_) {
@@ -161,8 +166,8 @@ void* HugetlbSysAllocator::Alloc(size_t size, size_t *actual_size,
MAP_SHARED, hugetlb_fd_, hugetlb_base_);
if (result == reinterpret_cast<void*>(MAP_FAILED)) {
if (!FLAGS_memfs_malloc_ignore_mmap_fail) {
- TCMalloc_MESSAGE(__FILE__, __LINE__, "mmap failed: %s\n",
- strerror(errno));
+ TCMalloc_MESSAGE(__FILE__, __LINE__, "mmap of size %"PRIuS" failed: %s\n",
+ size + extra, strerror(errno));
failed_ = true;
if (FLAGS_memfs_malloc_abort_on_fail) {
CRASH("memfs_malloc_abort_on_fail is set\n");