3 ms·
Still possible to have huge deallocations in C++. On top of that, C++ makes it possible to fragment memory, whereas .NET's GC can compact references. In both l
by com2kid 9y ago
Still possible to have huge deallocations in C++. On top of that, C++ makes it possible to fragment memory, whereas .NET's GC can compact references.
In both languages you have to be conscientious of types of allocations.
- MaulingMonkey 9y agoI've had to deal with "huge" deallocations causing stuttering before - by e.g. deferring deallocation over several frames. Deferred deallocation is also occasionally important for working around use-after-free bugs in middleware or system APIs that you don't have the source code to. Building and using the tools to track down and break up circular references, dangling pointers, leaks, visualize memory fragmentation, etc. has eaten up a lot of my time. I've considered attempting to write what would amount to a compacting GC in a C++ codebase to deal with memory fragmentation issues before - but retrofitting such a beast into an existing codebase was a huge enough undertaking, that we went for other simpler half measures instead. Being unable to control some middleware and system allocations meant any such GC would involve half measures and hacks as well anyways.