I am trying to track a memory leak in my .NET application. Windows Task Manager reports that memory usage remains constant, while Process Explorer reports that memory usage is increasing.
In the task manager, I look in a single column of memory, "Memory (private working set)." In Process Explorer, I look at the "Private bytes" column because it rises, but the value in "Workspace" is not.
Now, of course, Process Explorer is correct, because after several distributions my application crashes due to an Out of memory exception. The question is, why does the task manager incorrectly describe memory usage in the application ? Not only this, but also incorrectly reflects the global free memory of the system (the graph on the Performance tab remains constant).
My code is not needed, but here it is for completeness. It shows an empty window with a large array. When you press any key, the window closes and a new one opens, holding the new array. An old window has occurred, possibly due to an error in the qt4dotnet GUI library.
using System;
using com.trolltech.qt.gui;
namespace LeakTest
{
class Test : QWidget
{
public byte[] Data = new byte[1000 * 1000 * 100];
public Test()
{
show();
GC.Collect();
}
protected override void keyPressEvent(QKeyEvent arg__1)
{
disposeLater();
new Test();
}
[STAThread]
static void Main(string[] args)
{
QApplication.initialize(args);
new Test();
QApplication.exec();
}
}
}
OS: Windows 7
: "" 2D- [1000 * 1000 * 100][1], .