本文介绍了Windows任务管理器如何可靠地确定程序的内存使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用任务管理器来检测巨大的内存泄漏吗?我有一个小文本解析程序,显示内存使用大约640K时,我启动它。当我解析一个文件并索引它的内存使用增长取决于文件的大小。然后当我清除索引,我的内存使用下降到1400K左右。在这之后,我可以添加尽可能多的文件,当我清除索引,内存使用下降到这个1400k级别+或a〜5%。

Can I use task manager to detect huge memory leaks? I have a small text parsing program that shows memory usage of around 640K when I launch it. When I parse a file and index it the memory usage grows depending on the size of the file. Then when I "clear" the index, my memory usage drops down to around 1400K. After this point, I can add as many files as I want and when I clear the index, memory usage drops down to this 1400k level + or - a ~5%.

这是我在我的程序改变之后。在更改之前,内存使用将继续上升,每次我indexxed一些文件,然后清除。因此,在许多清除后,我的程序的内存使用正在增长和增长。

This is after I made a change in my program. Before the change the memory usage would continue to go up every time I indexxed some files then cleared. So after many clears, the memory use of my program was growing and growing.

我意识到这可能是一个hackish的方式来配置我的应用程序,一个学生,我所能找到的是商业分析工具,是无法触及。我也读过关于valgrind只是linux和我在windows上开发。

I realize that this is probably a "hackish" way to profile my app but I'm a student and all I've been able to find are commercial profiling tools which are out of reach. I've also read about valgrind which is linux only and I'm developing on windows. Is using the task manager accurate at all or am I misguided?

推荐答案

TaskMgr是一个非常粗略的工具,但它是有用的。如果你在一兆字节范围内有内存泄漏,那么它可能足以告诉你有它们。但是,最终,你将在10千字节和低于范围内寻找泄漏,而TaskMgr对这些泄漏是无用的。

TaskMgr is an extremely crude tool, but it is useful nonetheless. If you have memory leaks in the one megabyte range, then it is probably good enough to tell that you have them. But, eventually, you'll be looking for leaks in the 10 kilobyte and under ranges, and TaskMgr is useless for those.

这篇关于Windows任务管理器如何可靠地确定程序的内存使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 07:01