'find memory allocated between time A and time B which remains unfreed at time C

I know that Visual Studio allows you to compare memory between two time snapshots in order to find leaks, using the debugger-integrated Memory Usage diagnostic tool. However is there a way to filter out of the diff any memory that was allocated after another time point (B) between start time (A) and end time (C) ?

Time A = start caring about memory that gets allocated

Time B = stop caring

Time C = all memory that was allocated between Time A and Time B should now be freed; if not, let's see the callstack that allocated each chunk

This does not necessarily need to be done using Visual Studio interactive diagnostics tool if is there for example a way to do this using _CrtMemCheckpoint instead or another way.

Although I have tagged this as a Visual Studio 2019 question, I will accept any solution that uses freely available Microsoft tools such as WinDbg or Free Open Source tools such as VLD (Visual Leak Detector) to achieve the same result.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source