4 ms·
You can overload operator new to not use the heap. You can use allocators.
by atilaneves 8y ago
You can overload operator new to not use the heap. You can use allocators.
- heavenlyblue 8y agoOverloading new (for the purpose, of e.g. adding a thread-local allocator) adds implicit global state that isn't always easy to manage.
- gpderetta 8y agoSure, but no more than the standard allocator. Explicit allocator objects are a superior solution most of the time anyway.
- martinlaz 8y agoGood memory management is never easy on a system level, so if one is overloading new, they'd better be comfortable around the complexities involved.
- altmind 8y agoif you decide to use new/new[], you are bound to use the same allocator everywhere. c++ did not give you a chance to customize your allocation.