-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Currently we allocate 256 bytes for a single exception to be thrown in a single core system. This is useful for developers but has a cost of losing a bit more than 256 bytes of memory.
New behavior
- Keep a statically allocated polymorphic allocator (should be the cost of a pointer)
- The application is forced to set an exception allocator prior to using anything that can throw an exception
- If an exception is thrown without an allocator set, then the application terminates.
- The
set_exception_allocator()will allocate and deallocate an instance ofstd::bad_allocto verify that the allocator can at least allocatestd::bad_allocobject. The assumption will be that the allocator can at least allocatestd::bad_alloc. - If the exception allocator has completely exhausted and is unable to allocate a bad alloc object, then the application terminates.
Another option other than terminating the application would be to have some reserve memory for std::bad_alloc, but this has a per-thread cost that I think is unreasonable for many applications. So termination seems like the proper action if error reporting fails.
Metadata
Metadata
Assignees
Labels
No labels