3 ms·
If you replace the STL allocator with a non-throwing allocator how do you know that that vector you just push_back'd didn't actually allocate any new memory?
by cageface 15y ago
If you replace the STL allocator with a non-throwing allocator how do you know that that vector you just push_back'd didn't actually allocate any new memory?
- scott_s 15y agoYou don't. It will segfault.
- james4k 15y agoIndeed, you have to roll your own data structures. This is pretty common in the game development world, where exceptions are considered to have unpredictable performance characteristics.
- pestaa 15y agoThat is a pretty tight requirement, considering the internals of Ogre 3D engine. It is full with exception classes (some might argue it is way too overengineered.) Are custom data structures available as open source that don't use exceptions? Or perhaps can you please name an engine that already has this?
- james4k 15y agoThere is EASTL, though I've never used it myself. https://github.com/paulhodge/EASTL https://github.com/paulhodge/EASTL Valve's Source SDK makes extensive use of their own data structures, however it is very specialized. For example, linked lists are allocated as growing, contiguous blocks of memory to reduce cache misses. The Doom3 source code might be worth looking at, but I'm sure it's the same story. https://github.com/TTimo/doom3.gpl https://github.com/TTimo/doom3.gpl At the very least, there's a lot of great reference out there.