diff options
author | Aliaksey Kandratsenka <alk@tut.by> | 2015-08-02 10:53:32 -0700 |
---|---|---|
committer | Aliaksey Kandratsenka <alk@tut.by> | 2015-08-02 19:06:21 -0700 |
commit | 41aca070e85258d9d47b0ac47f5eddece8bf45ba (patch) | |
tree | 0a4391a40199dbec9c4f1dc52118552fca116953 /src/debugallocation.cc | |
parent | c4493874cd3b662d2778f3b79a3096ae61569b67 (diff) | |
download | gperftools-41aca070e85258d9d47b0ac47f5eddece8bf45ba.tar.gz |
always set errno to ENOMEM on OOM condition and in single place
While standards do not require us to set errno to ENOMEM in certain
places (like posix_memalign), existing code may sometimes set it
(i.e. because mmap or sbrk couldn't get memory from kernel)
anyways. And from my reading of glibc, it's malloc is doing more or
less same by just always setting ENOMEM on OOM condition.
This commit also eliminates some functions (XXX_no_errno) that are not
needed anymore.
Diffstat (limited to 'src/debugallocation.cc')
-rw-r--r-- | src/debugallocation.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/debugallocation.cc b/src/debugallocation.cc index 8487ca3..c170bc7 100644 --- a/src/debugallocation.cc +++ b/src/debugallocation.cc @@ -1193,7 +1193,7 @@ inline void* debug_cpp_alloc(size_t size, int new_type, bool nothrow) { data.size = size; data.new_type = new_type; return handle_oom(retry_debug_allocate, &data, - true, nothrow, true); + true, nothrow); } inline void* do_debug_malloc_or_debug_cpp_alloc(size_t size) { @@ -1205,7 +1205,7 @@ inline void* do_debug_malloc_or_debug_cpp_alloc(size_t size) { data.size = size; data.new_type = MallocBlock::kMallocType; return handle_oom(retry_debug_allocate, &data, - false, true, true); + false, true); } // Exported routines @@ -1384,7 +1384,7 @@ inline void* do_debug_memalign_or_debug_cpp_memalign(size_t align, data.align = align; data.size = size; return handle_oom(retry_debug_memalign, &data, - false, true, false); + false, true); } extern "C" PERFTOOLS_DLL_DECL void* tc_memalign(size_t align, size_t size) __THROW { |