Re: Memory leak more sample code
From: Slobodan Brcin \(eMVP\) (sbrcin_at_ptt.yu)
Date: 08/20/04
- Next message: Bruce Brown: "build error"
- Previous message: Slobodan Brcin \(eMVP\): "Re: El Torito Stop 0x0000007B Error"
- In reply to: Bill Baker: "Re: Memory leak more sample code"
- Next in thread: Sean Gahan: "Re: Memory leak more sample code"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 20 Aug 2004 23:14:20 +0200
Hi Bill,
Read trough similar problems and workarounds:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&c2coff=1&q=%22Process+performance%22&btnG=Search&meta=group%3Dmicrosoft.public.windowsxp.embedded.*
Hope that this helps.
Best regards,
Slobodan
"Bill Baker" <ba_baker@XXXXempowered.com> wrote in message news:elZUxJvhEHA.1652@TK2MSFTNGP09.phx.gbl...
> Hi Slobodan,
>
> Keith asked me to reply.
>
> Why are we using .Net? It is what we have been using for the rest of the
> solution, but I will explore the C++ option. It will be fun to code directly
> to the Win32API again :).
>
> Here is the stack dump for the problem when running under XP embedded:
>
> System.InvalidOperationException: Process performance counter is disabled,
> so the requested operation cannot be performed.
> at
> System.Diagnostics.NtProcessManager.GetProcessInfos(PerformanceCounterLib
> library)
> at System.Diagnostics.NtProcessManager.GetProcessInfos(String
> machineName, Boolean isRemoteMachine)
> at System.Diagnostics.ProcessManager.GetProcessInfos(String machineName)
> at System.Diagnostics.Process.EnsureState(State state)
> at System.Diagnostics.Process.get_MainWindowHandle()
> at SIMLauncher.Form1.Form1_Load(Object sender, EventArgs e)
> at System.Windows.Forms.Form.OnLoad(EventArgs e)
> at System.Windows.Forms.Form.OnCreateControl()
> at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
> at System.Windows.Forms.Control.CreateControl()
> at System.Windows.Forms.Control.WmShowWindow(Message& m)
> at System.Windows.Forms.Control.WndProc(Message& m)
> at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
> at System.Windows.Forms.ContainerControl.WndProc(Message& m)
> at System.Windows.Forms.Form.WmShowWindow(Message& m)
> at System.Windows.Forms.Form.WndProc(Message& m)
> at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
> at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
> at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
> IntPtr wparam, IntPtr lparam)
>
> "Slobodan Brcin (eMVP)" <sbrcin@ptt.yu> wrote in message
> news:e5B0TpthEHA.1392@TK2MSFTNGP11.phx.gbl...
> > Hi Keith,
> >
> > Why do you use .net for task that is simple as watching some process and
> restarting it?
> >
> > Use C++ or some other unmanaged language with Win32 API CreateProcess.
> > Also consider assigning process to job so you can kill all its descendant
> processes as that they never existed: Win32 API
> > CreateJobObject
> >
> > Anyhow regarding your question I can offer very limited help since I do
> not use .net.
> > There might be some features missing that your .net application try to use
> for purpose of process kill start.
> > Try using filemon and regmon utilities to see if there are some file or
> registry entries missing.
> >
> > Also providing us with exact point of failure (unsuccessful call) and
> return value would be great so we can narrow the problem down.
> >
> >
> > Best regards,
> > Slobodan
> >
> > "Keith Franklin, MS MVP" <Keith.Franklin@NoSpam.Empowered.Com> wrote in
> message news:eAw7GethEHA.160@TK2MSFTNGP10.phx.gbl...
> > > Using Windows API and still doesnt work...
> > > // on this version process.MainWindowHandle is the problem
> > >
> > > [DllImport("User32.dll", EntryPoint="SendMessageW")]
> > >
> > > static extern int SendMessageString(System.IntPtr hwnd, UInt32 wMsg,
> > >
> > > UInt32 wparam, string lparam);
> > >
> > > private const UInt32 WM_CLOSE = 0x0010;
> > >
> > > {
> > >
> > > process.StartInfo = new
> > >
> > > System.Diagnostics.ProcessStartInfo(programName, programParameters);
> > >
> > > while (!process.HasExited )
> > >
> > > {
> > >
> > > count++;
> > >
> > > process.WaitForExit(1000);
> > >
> > > if (count > resetWaitCount)
> > >
> > > {
> > >
> > > SendMessageString(process.MainWindowHandle, WM_CLOSE, 0, null);
> > >
> > > while (!process.HasExited)
> > >
> > > {
> > >
> > > System.Threading.Thread.Sleep(500);
> > >
> > > }
> > >
> > > process.Close();
> > >
> > > System.Threading.Thread.Sleep(resetDelay);
> > >
> > > process.Start();
> > >
> > > count = 0;
> > >
> > >
> > > }
> > >
> > > }
> > >
> > > process.Close();
> > >
> > >
> > > this.Close();
> > >
> > > }
> > >
> > >
> >
> >
>
>
- Next message: Bruce Brown: "build error"
- Previous message: Slobodan Brcin \(eMVP\): "Re: El Torito Stop 0x0000007B Error"
- In reply to: Bill Baker: "Re: Memory leak more sample code"
- Next in thread: Sean Gahan: "Re: Memory leak more sample code"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|