digitalmars.D.learn - What happens if memory allocation fails?
- tcak (8/8) Feb 20 2016 This is not easy to try. So I need ask, maybe someone has
- Kagamin (2/2) Feb 20 2016 Currently it crashes:
- Adam D. Ruppe (5/6) Feb 20 2016 Be aware that memory allocation might never actually fail. It
- Chris Wright (5/14) Feb 20 2016 core.exception.OutOfMemoryError.html
This is not easy to try. So I need ask, maybe someone has experienced. What happens if memory allocation fails with "new" keyword? Does it throw an exception? throwable? All I want is to be able to catch OutOfMemory event, and take other steps based on that.
Feb 20 2016
Currently it crashes: https://issues.dlang.org/show_bug.cgi?id=1180
Feb 20 2016
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
Feb 20 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: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.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/
Feb 20 2016