WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: juergenk on March 02, 2016, 04:39:55 AM

Title: Memory managment ?
Post by: juergenk on March 02, 2016, 04:39:55 AM
Hello guys,

i have a tool that so many will use more memory as my pc have. At the Task Manager i can see it when the Memory about the Process grow about xxx Bytes.
I want to create a Little wbt tool with warning me with an Message when the memory of the process have xxx Bytes. Then i can kill it.
What funktion can i use for permanent process memory Monitoring.

thanks for helping
Juergen
Title: Re: Memory managment ?
Post by: td on March 02, 2016, 08:14:09 AM
You have multiple choices.  You can use the WinBatch COM Automation along with WMI's 'Win32_Process' class:

https://msdn.microsoft.com/en-us/library/windows/desktop/aa394372%28v=vs.85%29.aspx
(https://msdn.microsoft.com/en-us/library/windows/desktop/aa394372%28v=vs.85%29.aspx)
or you cans use WinBatch CLR hosting (dotNet)  along with the 'System.Diagnostics.Process' class:

https://msdn.microsoft.com/en-us/library/system.diagnostics.process%28v=vs.110%29.aspx (https://msdn.microsoft.com/en-us/library/system.diagnostics.process%28v=vs.110%29.aspx)

or you can use the Process Extender's tGetProcInfo function.  You can find more information about tGetProcInfo by first downloading and installing the Process extender.  The function's information will then be available in the Consolidated WIL Help file.

There are also examples using these classes and function in the Tech Database.