track C++ memory allocations

前端 未结 8 1886
执笔经年
执笔经年 2020-11-28 04:18

I am looking for a way to track memory allocations in a C++ program. I am not interested in memory leaks, which seem to be what most tools are trying to find, but r

8条回答
  •  野性不改
    2020-11-28 04:45

    The Visual Studio IDE has built-in heap profiling support (since 2015), which is probably the easiest to start with. It has graphical views of heap usage over time, and can track allocations by function/method.

    • Measure memory usage in Visual Studio

    heap profiling

    The CRT also has debug and profile support, which is more detailed and more low-level. You could track the data and plot the results using some other tool:

    • CRT Debug Heap Details

    In particular, look at _CrtMemCheckpoint and related functions.

提交回复
热议问题