I see. Well, I'm referring to the bob object that was instantiated:
System.Diagnostics.Process bob = new System.Diagnostics.Process();
Will bob remain in memory after I exit the main app?
Just to be sure, I had to do put the code under the try..finally
block:
System.Diagnostics.Process bob = null;
try
{
bob = new System.Diagnostics.Process();
}
catch ()
{
...
}
finally
{
if (bob != null)
{
bob.Close();
}
}
Am I doing this correctly? Please advise.
Benj
On Aug 24, 4:55 pm, Petr Syromolotov <[email protected]>
wrote:
> The process you've started will continue executing and occupying memory.
> So from some point of view it's a "memory leak".
>
> On Mon, Aug 24, 2009 at 12:36 PM, Benj Nunez <[email protected]> wrote:
>
> > Good afternoon experts,
>
> > I need your input regarding a situation like this:
>
> > Suppose there's a code that spawns a process (invoke the Console
> > window) like this:
>
> > System.Diagnostics.Process bob = new System.Diagnostics.Process();
> > bob.StartInfo.UseShellExecute = true;
> > bob.StartInfo.Arguments += " /K TITLE Command Prompt";
> > bob.StartInfo.FileName = "CMD";
> > bob.Start();
>
> > And then, I deliberately close the main app that has the code above,
> > what will
> > happen to the process? Will it produce a memory leak?
>
> > Benj