… | |
… | |
114 | |
114 | |
115 | LOG (llevError, "fork abort: %s\n", msg); |
115 | LOG (llevError, "fork abort: %s\n", msg); |
116 | } |
116 | } |
117 | |
117 | |
118 | void * |
118 | void * |
119 | salloc_ (int n) |
119 | salloc_ (int n) noexcept |
120 | { |
120 | { |
121 | void *ptr = g_slice_alloc (n); |
121 | void *ptr = g_slice_alloc (n); |
122 | |
122 | |
123 | if (!ptr) |
123 | if (ecb_expect_false (!ptr)) |
124 | throw std::bad_alloc (); |
124 | { |
|
|
125 | LOG (llevError, "out of memory allocating %d bytes, aborting.\n", n); |
|
|
126 | abort (); |
|
|
127 | } |
125 | |
128 | |
126 | slice_alloc += n; |
129 | slice_alloc += n; |
127 | return ptr; |
130 | return ptr; |
128 | } |
131 | } |
129 | |
132 | |
|
|
133 | // thos noinline works around a bug in gcc10, which otherwise inlines |
|
|
134 | // this fucntion and, only in the inlined versions, optimises out |
|
|
135 | // the memset, leasving memory uninitialised. |
|
|
136 | ecb_noinline |
130 | void * |
137 | void * |
131 | salloc_ (int n, void *src) |
138 | salloc_ (int n, void *src) noexcept |
132 | { |
139 | { |
133 | void *ptr = salloc_ (n); |
140 | void *ptr = salloc_ (n); |
134 | |
141 | |
135 | if (src) |
142 | if (src) |
136 | memcpy (ptr, src, n); |
143 | memcpy (ptr, src, n); |