locked
process usage memory problem? RRS feed

  • Question

  • I developed one wpf application .. it allows users to start games... it runs some games.. but some games not running...

    proc.UseShellExecute = false;
    			        string direct= new System.IO.FileInfo(@"" + txtLocation.Text + "").Directory.ToString();
    				    proc.WorkingDirectory=direct;
                        proc.FileName = @"" + txtLocation.Text + "";
                        proc.CreateNoWindow = true;
    			        proc.Verb = "runas";
                        proc.RedirectStandardError = true;
                        proc.RedirectStandardOutput = true;
                        p1.StartInfo = proc;
                        p1.Start();
                        p1.PriorityClass = ProcessPriorityClass.High;

    it takes 200mb to 230mb  memory usage for my own application... help me to reduce memory usage..

    I am using this code for running game as process... I dono where I am doing wrong... and please give me any code example...


    <Kabilan>Learning C#</Kabilan>



    Tuesday, July 3, 2012 4:28 PM

Answers

  • It's hard to pin point with the given details. Nonetheless, I have few tips to give you

    1. It seems your wpf application not properly releasing or hold the process handles of those application which are initiated from host wpf. If this is the case then go with deterministic destruction approach which will release external application handles once it is launched. Find some useful tip on how to implement deterministic destruction here.

    2. Try to follow proper dispose pattern in your implementation. Find some useful tip from here.

    Note: There may be more suitable implementation for both dispose and deterministic destruction which you can find in internet using the given keywords. 

    In addition, if you already covering what I discussed then post your core logic for detailed support.


    If this post answers your question, please click Mark As Answer. If this post is helpful please click Mark as Helpful.

    Regards,
    Nairs

    • Marked as answer by Min Zhu Friday, August 10, 2012 2:23 AM
    Tuesday, July 3, 2012 4:47 PM