Any tool to find size of memory allocated dynamically using malloc/realloc?

后端 未结 4 1783
时光说笑
时光说笑 2021-01-23 19:44

I have a MS-Visual Studio 2005 workspace having all c code. This application(exe) allocates memory dynamically from heap using malloc and realloc. I want to calculate the maximu

4条回答
  •  独厮守ぢ
    2021-01-23 20:18

    I would recommend the following:

    1. It you do have access to the source code that you wish to analyze, replace all malloc/realloc calls with calls you your OWN function that would perform the analysis.
    2. If you don't have access to the source code, you can use the Detours library from Microsoft. The library intercepts calls to arbitrary functions and redirects them to the custom-made implementation. In this implementation you can perform the analysis and then fall back to standard malloc/realloc.

提交回复
热议问题