diff options
Diffstat (limited to 'src/tcmalloc.cc')
-rw-r--r-- | src/tcmalloc.cc | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/tcmalloc.cc b/src/tcmalloc.cc index a16e8ee..3e8e233 100644 --- a/src/tcmalloc.cc +++ b/src/tcmalloc.cc @@ -1087,21 +1087,6 @@ static void ReportLargeAlloc(Length num_pages, void* result) { write(STDERR_FILENO, buffer, strlen(buffer)); } -inline void* do_malloc(size_t size); - -static void *retry_malloc(void* size) { - return do_malloc(reinterpret_cast<size_t>(size)); -} - -inline void* do_malloc_or_cpp_alloc(size_t size) { - void *rv = do_malloc(size); - if (LIKELY(rv != NULL)) { - return rv; - } - return handle_oom(retry_malloc, reinterpret_cast<void *>(size), - false, true); -} - void* do_memalign(size_t align, size_t size); struct retry_memaligh_data { @@ -1195,6 +1180,19 @@ inline void* do_malloc(size_t size) { } } +static void *retry_malloc(void* size) { + return do_malloc(reinterpret_cast<size_t>(size)); +} + +inline void* do_malloc_or_cpp_alloc(size_t size) { + void *rv = do_malloc(size); + if (LIKELY(rv != NULL)) { + return rv; + } + return handle_oom(retry_malloc, reinterpret_cast<void *>(size), + false, true); +} + inline void* do_calloc(size_t n, size_t elem_size) { // Overflow check const size_t size = n * elem_size; |