diff options
author | Qi Wang <interwq@gwu.edu> | 2022-05-17 13:11:44 -0700 |
---|---|---|
committer | Qi Wang <interwq@gmail.com> | 2022-05-17 16:07:40 -0700 |
commit | cd5aaf308a46ce8ad0232ee9efb697b4ed33a7e4 (patch) | |
tree | a0e9294c8a41d411b64979bb1e2cd43cb5710f4c /src/jemalloc_cpp.cpp | |
parent | 70d4102f48dce2d5755e9139a15eeec606f97bff (diff) | |
download | jemalloc-cd5aaf308a46ce8ad0232ee9efb697b4ed33a7e4.tar.gz |
Improve the failure message upon opt_experimental_infallible_new.
Diffstat (limited to 'src/jemalloc_cpp.cpp')
-rw-r--r-- | src/jemalloc_cpp.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/jemalloc_cpp.cpp b/src/jemalloc_cpp.cpp index 451655f1..8b53a392 100644 --- a/src/jemalloc_cpp.cpp +++ b/src/jemalloc_cpp.cpp @@ -57,8 +57,14 @@ JEMALLOC_NOINLINE static void * handleOOM(std::size_t size, bool nothrow) { if (opt_experimental_infallible_new) { - safety_check_fail("<jemalloc>: Allocation failed and " - "opt.experimental_infallible_new is true. Aborting.\n"); + const char *huge_warning = (size >= ((std::size_t)1 << 30)) ? + "This may be caused by heap corruption, if the large size " + "is unexpected (suggest building with sanitizers for " + "debugging)." : ""; + + safety_check_fail("<jemalloc>: Allocation of size %zu failed. " + "%s opt.experimental_infallible_new is true. Aborting.\n", + size, huge_warning); return nullptr; } |