473,586 Members | 2,682 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Here is a part of my code:

internal bool Excute(string input)
{

ProcessStartInf o psi = new ProcessStartInf o();
psi.FileName = this.filePathTo Excute;

psi.RedirectSta ndardOutput = true;
psi.RedirectSta ndardError = true;
psi.RedirectSta ndardInput = true;
psi.UseShellExe cute = false;

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

p.ErrorDataRece ived += new
DataReceivedEve ntHandler(p_Err orDataReceived) ;
p.OutputDataRec eived += new
DataReceivedEve ntHandler(p_Out putDataReceived );
p.Start();

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

p.BeginOutputRe adLine();
p.BeginErrorRea dLine();

p.WaitForExit(2 000);

if (!p.HasExited)
{
p.ErrorDataRece ived -= new
DataReceivedEve ntHandler(p_Err orDataReceived) ;
p.OutputDataRec eived -= new
DataReceivedEve ntHandler(p_Out putDataReceived );

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

return false;
}

excuteTime = p.TotalProcesso rTime;
peakMemory =p.PrivateMemor ySize64;//And again. It is the
right place to get the information of memory used by the process p
here??
/* NonpagedSystemM emorySize64=p.N onpagedSystemMe morySize64;
PagedMemorySize 64=p.PagedMemor ySize64;
PagedSystemMemo rySize64=p.Page dSystemMemorySi ze64;
PeakPagedMemory Size64=p.PeakPa gedMemorySize64 ;
PeakVirtualMemo rySize64=p.Peak VirtualMemorySi ze64;
PeakWorkingSet6 4=p.PeakWorking Set64;
PrivateMemorySi ze64=p.PrivateM emorySize64;
VirtualMemorySi ze64=p.VirtualM emorySize64;
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
2 5716
Hi,
A confused boy is lingering to find the information of physical memory
used by the process.
The documentation on MSDN is thorough - I found the answer quickly here:

"Process.PeakWo rkingSet64"
http://msdn2.microsoft.com/en-us/lib...64(VS.80).aspx

--
Dave Sexton

"Lyon" <zl*****@gmail. comwrote in message
news:11******** **************@ j44g2000cwa.goo glegroups.com.. .
Here is a part of my code:

internal bool Excute(string input)
{

ProcessStartInf o psi = new ProcessStartInf o();
psi.FileName = this.filePathTo Excute;

psi.RedirectSta ndardOutput = true;
psi.RedirectSta ndardError = true;
psi.RedirectSta ndardInput = true;
psi.UseShellExe cute = false;

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

p.ErrorDataRece ived += new
DataReceivedEve ntHandler(p_Err orDataReceived) ;
p.OutputDataRec eived += new
DataReceivedEve ntHandler(p_Out putDataReceived );
p.Start();

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

p.BeginOutputRe adLine();
p.BeginErrorRea dLine();

p.WaitForExit(2 000);

if (!p.HasExited)
{
p.ErrorDataRece ived -= new
DataReceivedEve ntHandler(p_Err orDataReceived) ;
p.OutputDataRec eived -= new
DataReceivedEve ntHandler(p_Out putDataReceived );

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

return false;
}

excuteTime = p.TotalProcesso rTime;
peakMemory =p.PrivateMemor ySize64;//And again. It is the
right place to get the information of memory used by the process p
here??
/* NonpagedSystemM emorySize64=p.N onpagedSystemMe morySize64;
PagedMemorySize 64=p.PagedMemor ySize64;
PagedSystemMemo rySize64=p.Page dSystemMemorySi ze64;
PeakPagedMemory Size64=p.PeakPa gedMemorySize64 ;
PeakVirtualMemo rySize64=p.Peak VirtualMemorySi ze64;
PeakWorkingSet6 4=p.PeakWorking Set64;
PrivateMemorySi ze64=p.PrivateM emorySize64;
VirtualMemorySi ze64=p.VirtualM emorySize64;
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 #2
Thank you very much!!

"Dave Sexton дµÀ£º
"
Hi,
A confused boy is lingering to find the information of physical memory
used by the process.

The documentation on MSDN is thorough - I found the answer quickly here:

"Process.PeakWo rkingSet64"
http://msdn2.microsoft.com/en-us/lib...64(VS.80).aspx

--
Dave Sexton

"Lyon" <zl*****@gmail. comwrote in message
news:11******** **************@ j44g2000cwa.goo glegroups.com.. .
Here is a part of my code:

internal bool Excute(string input)
{

ProcessStartInf o psi = new ProcessStartInf o();
psi.FileName = this.filePathTo Excute;

psi.RedirectSta ndardOutput = true;
psi.RedirectSta ndardError = true;
psi.RedirectSta ndardInput = true;
psi.UseShellExe cute = false;

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

p.ErrorDataRece ived += new
DataReceivedEve ntHandler(p_Err orDataReceived) ;
p.OutputDataRec eived += new
DataReceivedEve ntHandler(p_Out putDataReceived );
p.Start();

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

p.BeginOutputRe adLine();
p.BeginErrorRea dLine();

p.WaitForExit(2 000);

if (!p.HasExited)
{
p.ErrorDataRece ived -= new
DataReceivedEve ntHandler(p_Err orDataReceived) ;
p.OutputDataRec eived -= new
DataReceivedEve ntHandler(p_Out putDataReceived );

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

return false;
}

excuteTime = p.TotalProcesso rTime;
peakMemory =p.PrivateMemor ySize64;//And again. It is the
right place to get the information of memory used by the process p
here??
/* NonpagedSystemM emorySize64=p.N onpagedSystemMe morySize64;
PagedMemorySize 64=p.PagedMemor ySize64;
PagedSystemMemo rySize64=p.Page dSystemMemorySi ze64;
PeakPagedMemory Size64=p.PeakPa gedMemorySize64 ;
PeakVirtualMemo rySize64=p.Peak VirtualMemorySi ze64;
PeakWorkingSet6 4=p.PeakWorking Set64;
PrivateMemorySi ze64=p.PrivateM emorySize64;
VirtualMemorySi ze64=p.VirtualM emorySize64;
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 22 '06 #3

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

Similar topics

1
1818
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 there a Python module I could use to determine the actual amount of memory
7
2427
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 center cluster that are each running a number of web applications. For some reason one of the boxes' asp_wp process keeps recylcing on us. It seems...
2
1917
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 this point when the see the memory used by the program in task manager it is 135,654K. Now when I minimize the application the memory goes down to...
3
1576
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 application.
0
1465
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; psi.RedirectStandardError = true;
1
2849
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 things: 1. size of compressed file 2. elapsed time (clock or preferably CPU) 3. memory used The first is straightforward, as is measuring...
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 memory segment if it is open to all, i.e. shared memory mapped into all processes memory area. I don't want to use TCP/IP client/server between...
3
1872
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 possible reasons of an error like glibc detected:malloc() memory corruption when the program executes almost the same function abt 2000 times with
3
3165
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 the functions have been run a few thousand times all of the memory used by those functions has been un-allocated, i.e. that there are no memory leaks....
0
7912
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7839
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8202
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8338
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6614
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5390
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.