From 0e88ae9710ca94712187ca3a00c654acf4d82994 Mon Sep 17 00:00:00 2001 From: chexiongsheng Date: Tue, 13 Aug 2024 23:26:25 +0800 Subject: [PATCH] no throw --- node-script/wrap_symbols.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/node-script/wrap_symbols.cc b/node-script/wrap_symbols.cc index 1c383a7..10b3a69 100644 --- a/node-script/wrap_symbols.cc +++ b/node-script/wrap_symbols.cc @@ -126,7 +126,8 @@ void* __puerts_wrap__ZnamSt11align_val_t(unsigned long size, size_t alignment) { #else void* ptr = nullptr; if (posix_memalign(&ptr, alignment, size) != 0) { - throw std::bad_alloc(); + fprintf(stderr, "Fatal process out of memory for new"); + abort(); } return ptr; #endif @@ -147,7 +148,7 @@ void* __puerts_wrap__ZnamSt11align_val_tRKSt9nothrow_t(unsigned long size, size_ #else void* ptr = nullptr; if (posix_memalign(&ptr, alignment, size) != 0) { - throw std::bad_alloc(); + return nullptr; } return ptr; #endif @@ -168,7 +169,8 @@ void* __puerts_wrap__ZnwmSt11align_val_t(unsigned long size, size_t alignment) { #else void* ptr = nullptr; if (posix_memalign(&ptr, alignment, size) != 0) { - throw std::bad_alloc(); + fprintf(stderr, "Fatal process out of memory for new"); + abort(); } return ptr; #endif @@ -189,7 +191,7 @@ void* __puerts_wrap__ZnwmSt11align_val_tRKSt9nothrow_t(unsigned long size, size_ #else void* ptr = nullptr; if (posix_memalign(&ptr, alignment, size) != 0) { - throw std::bad_alloc(); + return nullptr; } return ptr; #endif