What happens if memory allocation fails?
Chris Wright via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Feb 20 09:08:45 PST 2016
On Sat, 20 Feb 2016 16:58:02 +0000, Adam D. Ruppe wrote:
> On Saturday, 20 February 2016 at 14:21:28 UTC, tcak wrote:
>> What happens if memory allocation fails with "new" keyword?
>
> Be aware that memory allocation might never actually fail. It really
> depends on the operating system.
>
> But if it did fail, it would throw OutOfMemoryError
>
> http://dpldocs.info/experimental-docs/
core.exception.OutOfMemoryError.html
That should work for address space exhaustion on most any OS and
configuration. Physical memory plus swap exhaustion, not so much, thanks
to memory overcommitment.
More information about the Digitalmars-d-learn
mailing list