runtime hook for Crash on Error
Artur Skawina
art.08.09 at gmail.com
Fri Jun 1 11:30:47 PDT 2012
On 06/01/12 19:59, Steven Schveighoffer wrote:
> On Fri, 01 Jun 2012 13:50:16 -0400, Walter Bright <newshound2 at digitalmars.com> wrote:
>
>> On 6/1/2012 5:29 AM, Steven Schveighoffer wrote:
>>> No. What we need is a non-throwing version of malloc that returns NULL.
>>
>> We have it. It's called "malloc"!
>
> Oh sorry, I meant *GC.malloc* :)
auto GC_malloc(size_t s) nothrow { void *p; try p = GC.malloc(s); catch {} return p; }
Which isn't ideal, but probably good enough - it's not like OOM will happen
often enough that the exception overhead matters.
The various implicit allocations will be more problematic, once GC.malloc
starts to fail.
artur
More information about the Digitalmars-d
mailing list