473,508 Members | 2,454 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help!! How can I get the information of the memory used of a process??

Here is a part of my code:

internal bool Excute(string input)
{

ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = this.filePathToExcute;

psi.RedirectStandardOutput = true;
psi.RedirectStandardError = true;
psi.RedirectStandardInput = true;
psi.UseShellExecute = false;

Process p = new Process();
p.StartInfo = psi;

p.ErrorDataReceived += new
DataReceivedEventHandler(p_ErrorDataReceived);
p.OutputDataReceived += new
DataReceivedEventHandler(p_OutputDataReceived);
p.Start();

//peakMemory = p.PeakWorkingSet64;//It is the right place
to get the information of memory used by the process p here??

p.BeginOutputReadLine();
p.BeginErrorReadLine();

p.WaitForExit(2000);

if (!p.HasExited)
{
p.ErrorDataReceived -= new
DataReceivedEventHandler(p_ErrorDataReceived);
p.OutputDataReceived -= new
DataReceivedEventHandler(p_OutputDataReceived);

p.Kill();
p.Close();

return false;
}

excuteTime = p.TotalProcessorTime;
peakMemory =p.PrivateMemorySize64;//And again. It is the
right place to get the information of memory used by the process p
here??
/* NonpagedSystemMemorySize64=p.NonpagedSystemMemoryS ize64;
PagedMemorySize64=p.PagedMemorySize64;
PagedSystemMemorySize64=p.PagedSystemMemorySize64;
PeakPagedMemorySize64=p.PeakPagedMemorySize64;
PeakVirtualMemorySize64=p.PeakVirtualMemorySize64;
PeakWorkingSet64=p.PeakWorkingSet64;
PrivateMemorySize64=p.PrivateMemorySize64;
VirtualMemorySize64=p.VirtualMemorySize64;
WorkingSet64 = p.WorkingSet64;

*/ //Here are so many memory information related properties of the
process, and which one is the physical memory used by the process p??

p.Close();
}
Thank you very much!

A confused boy is lingering to find the information of physical memory
used by the process.

Nov 21 '06 #1
0 1454

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1812
by: Avi Kak | last post by:
Hello: My apologies in advance for asking a question that probably has been raised numerous times already in this newsgroup. My Google search did not lead me to an answer I could use. Is...
7
2422
by: Rich Denis | last post by:
Hello, I have been trying to solve a mysterious memory leak problem and was hoping that you could help me out on my stuck point. First a bit of background. We have two app servers in an app...
2
1913
by: Asfar | last post by:
Hi, I have a VS2005 windows program written in c#. In this program I have an array list which stores many DataTable's. When I first run the pogram the arraylist is loaded with datatables. At...
3
1569
by: Avi | last post by:
Hi all, In my program I need to know the memory used by certain applications. I was able to get the free available memory on the machine, but not the memory that is used by a specific...
2
5706
by: Lyon | last post by:
Here is a part of my code: internal bool Excute(string input) { ProcessStartInfo psi = new ProcessStartInfo(); psi.FileName = this.filePathToExcute; psi.RedirectStandardOutput = true;...
1
2828
by: Andrew McLean | last post by:
I want to script the benchmarking of some compression algorithms on a Windows box. The algorithms are all embodied in command line executables, such as gzip and bzip2. I would like to measure three...
5
587
by: Sune | last post by:
Hi all, I want to make data stored in-memory (not disk) available to several processes. My concern is that poorly written C applications with dangling pointers may(will) damage the data in this...
3
1866
by: mohi | last post by:
hello everyone , is there any cmmnd in gdb or any other way to find out whats the total dynamically allocated memory a process holds at various instances of execution??? and what can be the...
3
3162
by: Salim Fadhley | last post by:
I'm trying to create a python unit-test which will test a complex program which includes a number of functions which have been implemented in C or C++. The unit-test needs to check that after...
0
7129
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7333
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7398
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5637
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5057
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4716
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3194
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.