--- deliantra/server/common/utils.C 2018/12/05 19:03:26 1.109 +++ deliantra/server/common/utils.C 2022/10/08 21:54:05 1.110 @@ -116,19 +116,26 @@ } void * -salloc_ (int n) +salloc_ (int n) noexcept { void *ptr = g_slice_alloc (n); - if (!ptr) - throw std::bad_alloc (); + if (ecb_expect_false (!ptr)) + { + LOG (llevError, "out of memory allocating %d bytes, aborting.\n", n); + abort (); + } slice_alloc += n; return ptr; } +// thos noinline works around a bug in gcc10, which otherwise inlines +// this fucntion and, only in the inlined versions, optimises out +// the memset, leasving memory uninitialised. +ecb_noinline void * -salloc_ (int n, void *src) +salloc_ (int n, void *src) noexcept { void *ptr = salloc_ (n);