任何找到使用malloc / realloc动态分配的内存大小的工具? [英] Any tool to find size of memory allocated dynamically using malloc/realloc?
问题描述
我不想更改代码通过注意到malloc大小并累积它们,因为:
a)可能会有一个场景,1KB的一些内存是malloc'ed,然后被释放,然后一个2KB的内存是malloc'ed。所以最大是2KB,我需要得到的值不是1 + 2 = 3KB。
所以我必须真正看到这里malloc / free发生了什么代码和添加代码,我想避免。
1)所以有什么工具(免费软件/许可)找到动态分配的最大或总内存的大小使用malloc / realloc?
2)MS Visual Studio 2005/2008本身是否提供了这样的任何东西?
谢谢,
-AD
内存验证器可以做到
有几种不同的报告,您会发现有用的:
-
运行总计。这是一个对话框,提供每个主内存分配器(C运行时,HeapAlloc,LocalAlloc,GlobalAlloc,CoTaskMemAlloc等)的当前累积值和总值。
-
对象。这是主要选项卡之一,显示对象类型,大小,计数,累积。
每个线程和每个dll值也是子选项。 -
大小。这是主要选项卡之一,并显示大小,计数,累积。
每个线程和每个dll值也是subtab。 -
虚拟。这将显示内存的图形视图(一个像素==一页内存),并显示虚拟内存页面和虚拟内存段落的详细虚拟内存数据的子选项。
全面披露:我是Memory Validator团队的一员。
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 maximum size allocated size allocated on heap using malloc/realloc by this application program when i run particular test case.
I do not want to change the code by noting the malloc sizes and accumulating them, because:
a) there can be a scenario, that some memory of 1KB is malloc'ed, then freed, and then a memory of 2KB is malloc'ed. So max is 2KB, which i need to get as the value and not 1+2=3KB.
So i have to really see whereall malloc/free is happening in this code and add code for this, which i want to avoid.
1) So are there any tools(freeware/licensed) to find size of maximum or total memory allocated dynamically using malloc/realloc?
2)Does MS Visual Studio 2005/2008 itself provide anything of this sort?
thanks,
-AD
Memory Validator can do this.
There are several different reports that you will find useful:
Running Totals. This is presented as a dialog box and provides current, cumulative and total values for each of the main memory allocator (C runtime, HeapAlloc, LocalAlloc, GlobalAlloc, CoTaskMemAlloc, etc).
Objects. This is one of the main tabs and displays object type, size, count, cumulative. Also subtabs for per-thread and per-dll values.
Sizes. This is one of the main tabs and displays size, count, cumulative. Also subtabs for per-thread and per-dll values.
Virtual. This displays a graphical view of memory (one pixel == one page of memory) and has subtabs showing detailed virtual memory data for virtual memory pages and virtual memory paragraphs.
Full disclosure: I am part of the Memory Validator team.
这篇关于任何找到使用malloc / realloc动态分配的内存大小的工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!