diff --git a/src/common/classes/alloc.cpp b/src/common/classes/alloc.cpp index ca43e4de9a..762b658f25 100644 --- a/src/common/classes/alloc.cpp +++ b/src/common/classes/alloc.cpp @@ -420,26 +420,6 @@ MemBlock* MemoryPool::alloc(const size_t length) throw (std::bad_alloc) return block; } -void* MemoryPool::allocate_nothrow(size_t size -#ifdef DEBUG_GDS_ALLOC - , const char* file, int line -#endif -) throw () -{ - try - { -#ifdef DEBUG_GDS_ALLOC - return allocate(size, file, line); -#else - return allocate(size); -#endif - } - catch (const Firebird::Exception&) - { - return NULL; - } -} - void* MemoryPool::allocate(size_t size #ifdef DEBUG_GDS_ALLOC , const char* fileName, int line diff --git a/src/common/classes/alloc.h b/src/common/classes/alloc.h index ddbe8011a0..24e34bda55 100644 --- a/src/common/classes/alloc.h +++ b/src/common/classes/alloc.h @@ -303,13 +303,6 @@ public: static void deallocate(void* block) throw (); void validate(void) throw (); - // Allocate memory block. In case of problems this method returns NULL - void* allocate_nothrow(size_t size -#ifdef DEBUG_GDS_ALLOC - , const char* file = NULL, int line = 0 -#endif - ) throw (); - #ifdef LIBC_CALLS_NEW static void* globalAlloc(size_t s) throw (std::bad_alloc); #else diff --git a/src/jrd/cch.cpp b/src/jrd/cch.cpp index 3bdca37c7b..aa2e38425d 100644 --- a/src/jrd/cch.cpp +++ b/src/jrd/cch.cpp @@ -3534,8 +3534,7 @@ static void expand_buffers(thread_db* tdbb, ULONG number) if (!num_in_seg) { const size_t alloc_size = dbb->dbb_page_size * (num_per_seg + 1); - memory = (UCHAR*) dbb->dbb_bufferpool->allocate_nothrow(alloc_size); - // NOMEM: crash! + memory = (UCHAR*) dbb->dbb_bufferpool->allocate(alloc_size); new_block->bcb_memory.push(memory); memory = (UCHAR *) FB_ALIGN((U_IPTR) memory, dbb->dbb_page_size); num_in_seg = num_per_seg; diff --git a/src/jrd/gds.cpp b/src/jrd/gds.cpp index 710425923d..9017094691 100644 --- a/src/jrd/gds.cpp +++ b/src/jrd/gds.cpp @@ -217,11 +217,18 @@ static gds_msg* global_default_msg = NULL; VoidPtr API_ROUTINE gds__alloc_debug(SLONG size_request, const TEXT* filename, ULONG lineno) { - return getDefaultMemoryPool()->allocate_nothrow(size_request + try + { + return getDefaultMemoryPool()->allocate(size_request #ifdef DEBUG_GDS_ALLOC - , filename, lineno + , filename, lineno #endif - ); + ); + } + catch (const Firebird::Exception&) + { + return NULL; + } } ULONG API_ROUTINE gds__free(void* blk) @@ -3635,11 +3642,18 @@ void gds__trace_printer(void* /*arg*/, SSHORT offset, const TEXT* line) VoidPtr API_ROUTINE gds__alloc(SLONG size_request) { - return getDefaultMemoryPool()->allocate_nothrow(size_request + try + { + return getDefaultMemoryPool()->allocate(size_request #ifdef DEBUG_GDS_ALLOC - , __FILE__, __LINE__ + , __FILE__, __LINE__ #endif - ); + ); + } + catch (const Firebird::Exception&) + { + return NULL; + } }