On Saturday, October 12, 2024, Jeremy Rifkin wrote:

How about using a preprocessor define to clean up the allocations properly when using memory tooling or even just in debug in general while letting it leak in release.



That's exactly what I'm saying "std::deliberate_leak" should do (see the implementation in my original post). Or maybe it could do one of two things:
    A) Deallocate all leaks before death of process
    B) Somehow signal to debuggers that the leak is deliberate

I think in future my program will have 3 builds in future:

    a - Debug
    b - Release Without Leaks
    c - Release With Leaks

However if 'c' is only 120 milliseconds quicker to die than 'b', then I won't bother with 'c', I'll just have 'a' and 'b'.