I have strange trouble, I created console app App1, only purpose of this app is to get argument (val) check if this value is greater than zero if yes then run the same app (App1) with val-- in argument and turn off.
I run this app from scheduled task, I run it every one minute. The problem is that when I run this application with开发者_StackOverflow中文版 1000 as argument it hangs my computer after two or three minutes (blue screen). For argument like 10 everything works fine.
I need this app to test some problem with memory management on different machine.
I runned following code:
static void Main( string[] args )
{
if ( args.Length > 0 )
{
int val = 0;
try
{
Int32.TryParse( args[ 0 ], out val );
}
catch ( Exception ex )
{ }
if ( val > 0 )
{
val--;
ProcessStartInfo psi = new ProcessStartInfo(System.Windows.Forms.Application.ExecutablePath, val.ToString() );
psi.CreateNoWindow = true;
psi.WindowStyle = ProcessWindowStyle.Hidden;
Process.Start( psi );
}
System.Console.WriteLine( args[ 0 ] );
}
System.Console.WriteLine( "App" );
}
How exactly are you determining how much memory is available? Are you looking at the "Free" section in the "Physical Memory" box in the Windows Task Manager?
If so, stop doing that. On my machine right now, that number indicates I have 6 MB free. Since I have 5 GB of RAM total, with only a few instances of Chrome and VS 2010 running, I seriously doubt that I've consumed all of my available RAM.
In fact, you shouldn't ever Task Manager to do memory profiling. That answers both of your most recent questions. There's absolutely no memory leak, and you don't need to do this silly regression testing.
精彩评论