track C++ memory allocations

前端 未结 8 1821
执笔经年
执笔经年 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.

    0 讨论(0)
  • 2020-11-28 04:47

    "A graphical representation of the heap over time" - close to what you are looking for is implemented in Intel(R) Single Event API, details can be found in this article (its rather big to put it here).

    It shows you timeline of per-block-size allocations and allows to add additional mark up to your code to understand the whole picture better.

    0 讨论(0)
提交回复
热议问题