You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Visual Studio C runtime has a debugging mechanism to spot memory leaks.
In the main function, _CrtSetDbgFlag can be used to enable that mechanism.
When CATCH returns after having executed all tests, MSVC displays the list of memory blocks that have not be freed.
By setting _crtBreakAlloc and rerun the test, CATCH will stop at the allocation of the leaked block
(provided the allocation sequence is exactly the same).
The _CRTDBG_DELAY_FREE_MEM_DF flag in my reference commit should in fact be avoided, as it will prevent memory from being physically released.
We only need _CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF);
If I understand this correctly, its a recommendation/request to hook up with MSVC CRT leak checker into Catch's main, so that memory leaks in tested code can be found?
That is potentially very interesting addition but it might be a while before I can get around to it (but seeing how the issue is from 2015, its been a while anyway).
Visual Studio C runtime has a debugging mechanism to spot memory leaks.
In the
main
function,_CrtSetDbgFlag
can be used to enable that mechanism.When CATCH returns after having executed all tests, MSVC displays the list of memory blocks that have not be freed.
By setting
_crtBreakAlloc
and rerun the test, CATCH will stop at the allocation of the leaked block(provided the allocation sequence is exactly the same).
See my commit for reference:
prapin@a4695cc
The text was updated successfully, but these errors were encountered: