1

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 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" );
}
Darqer
  • 2,847
  • 9
  • 45
  • 65
  • Trying to start 1000 processes (what your code is doing) will be at best slow. Please comment what your expect as it is unclear what does not work the way you want. – Alexei Levenkov Feb 07 '11 at 23:23
  • This is my code, no more, I just want to run app that run app that run app and so one. When application run app then it should exit. So I got chain of application. I run it on my computer and get blue screen a few times and I wonder why. I looked at memory usage and it is OK, Processor utilization is at 100% but it should not be the case. – Darqer Feb 07 '11 at 23:27
  • 1
    Why do you need to start 1000 processes in order to achieve absolutely nothing? What is this app supposed to do? Additionally, telling us that you get a "blue screen" is not very informative - there are hundreds of possible bluescreens, and it would be helpful to tell us the actual error code reported. – Anon. Feb 07 '11 at 23:27
  • I need to test memory issue on another machine. I notice that when I exit.net application always some part of system memory is missing (amount of used memory is rising) so after a few hours of work there is no available memory. I wanted to create really simple application and run it a few times and check if this problem occur for simpler case. Then I run it for test on my machine and stumble upon described trouble. I asked because maybe I forgot to release something obvious, or maybe it is some generic problem of process.start. – Darqer Feb 07 '11 at 23:44
  • I tried to get error message from blue screen but it flashes to fast (strange because I have configured windows to wait in this case for my action) – Darqer Feb 08 '11 at 00:00

1 Answers1

1

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?

   Windows Task Manager is not a memory profiling tool

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.

Community
  • 1
  • 1
Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
  • I look at Memory graph. It is strange because with time performance of my server is decreasing hardly and I believe that it is result of memory consumption, when I do not run this .net application everything works fine. – Darqer Feb 08 '11 at 15:55