[cfe-dev] What clang should do when memory is exhausted?
Douglas Gregor
dgregor at apple.com
Tue Mar 20 14:56:17 PDT 2012
On Mar 20, 2012, at 4:41 AM, Abramo Bagnara wrote:
> Il 18/03/2012 12:51, Abramo Bagnara ha scritto:
>> In http://llvm.org/docs/CodingStandards.html#ci_rtti_exceptions I read
>> that exceptions are not used by design in clang code base.
>>
>> Despite this in source there are a lot of unguarded call to new
>> operator, does this means that when memory is lacking the compiler
>> executable is meant to fail in arbitrary way?
>
> I'd correct myself replacing "fail in arbitrary way" with "execute
> arbitrary code".
>
> Can I suggest the use in clang executables of set_new_handler (C++
> lib.set.new.handler) to have a graceful exit when memory is exhausted?
>
> Is it an acceptable solution?
Seems okay for the compiler proper. For libclang, we'd probably just want to trap to kill the current thread.
- Doug
More information about the cfe-dev
mailing list