如何获取函数消耗的内存

时间:2022-05-31 21:22:32

Our application consumes lots of memory and we need to identify which function cause the maximum usage of the memory. Is their any way or even any existing tool to do this(Windows, Native)?

我们的应用程序占用大量内存,我们需要确定哪个函数会导致内存的最大使用量。他们以任何方式甚至任何现有工具来做到这一点(Windows,Native)?

Here is the environment:

这是环境:

Windows Xp

VS2008

Native C++ (MFC Based)

Native C ++(基于MFC)

Thanks so much.

非常感谢。

3 个解决方案

#1


If you have Visual Studio 2008 Team System you can use the built-in memory allocation profiler. Here's a good MSDN article, Find Application Bottlenecks with Visual Studio Profiler using VS2008. There is also a profiler blog.

如果您有Visual Studio 2008 Team System,则可以使用内置内存分配探查器。这是一篇很好的MSDN文章,使用VS2008使用Visual Studio Profiler查找应用程序瓶颈。还有一个探查器博客。

RedGate's ANTS

MemProfiler

ValGrind (free)

EDIT: since you updated to indicate C++, please also see this SO answer.

编辑:既然你更新了C ++,请看这个答案。

See Also:

.NET Memory Profiling Tools

.NET内存分析工具

Does anyone here have a favorite memory profiling/memory leak tool they like to use for their java webapps?

这里有没有人有他们喜欢用于他们的java webapps的最喜欢的内存分析/内存泄漏工具?

Best .NET memory and performance profiler?

最好的.NET内存和性能分析器?

#2


Use a profiler. such as Automated QA's AQTime - http://www.automatedqa.com/products/aqtime/index.asp.

使用分析器。例如Automated QA的AQTime - http://www.automatedqa.com/products/aqtime/index.asp。

#3


Most tools/profilers operate only on .NET apps which in your case is n/a

大多数工具/分析器仅在.NET应用程序上运行,在您的情况下是不适用的

I've used Boundschecker and Purify to check for memory leaks/memory profiling for native applications (they got trial versions AFAIK) but you can also use the built in functions for this purpose if you are just interested in a one-shot analysis

我已经使用Boundschecker和Purify来检查本机应用程序的内存泄漏/内存分析(它们有试用版AFAIK)但是如果你只对一次性分析感兴趣的话,你也可以使用内置函数来实现这个目的。

look for _crtCheckMemory in your online help for a starting location.

在您的在线帮助中查找_crtCheckMemory以获取起始位置。

#1


If you have Visual Studio 2008 Team System you can use the built-in memory allocation profiler. Here's a good MSDN article, Find Application Bottlenecks with Visual Studio Profiler using VS2008. There is also a profiler blog.

如果您有Visual Studio 2008 Team System,则可以使用内置内存分配探查器。这是一篇很好的MSDN文章,使用VS2008使用Visual Studio Profiler查找应用程序瓶颈。还有一个探查器博客。

RedGate's ANTS

MemProfiler

ValGrind (free)

EDIT: since you updated to indicate C++, please also see this SO answer.

编辑:既然你更新了C ++,请看这个答案。

See Also:

.NET Memory Profiling Tools

.NET内存分析工具

Does anyone here have a favorite memory profiling/memory leak tool they like to use for their java webapps?

这里有没有人有他们喜欢用于他们的java webapps的最喜欢的内存分析/内存泄漏工具?

Best .NET memory and performance profiler?

最好的.NET内存和性能分析器?

#2


Use a profiler. such as Automated QA's AQTime - http://www.automatedqa.com/products/aqtime/index.asp.

使用分析器。例如Automated QA的AQTime - http://www.automatedqa.com/products/aqtime/index.asp。

#3


Most tools/profilers operate only on .NET apps which in your case is n/a

大多数工具/分析器仅在.NET应用程序上运行,在您的情况下是不适用的

I've used Boundschecker and Purify to check for memory leaks/memory profiling for native applications (they got trial versions AFAIK) but you can also use the built in functions for this purpose if you are just interested in a one-shot analysis

我已经使用Boundschecker和Purify来检查本机应用程序的内存泄漏/内存分析(它们有试用版AFAIK)但是如果你只对一次性分析感兴趣的话,你也可以使用内置函数来实现这个目的。

look for _crtCheckMemory in your online help for a starting location.

在您的在线帮助中查找_crtCheckMemory以获取起始位置。