Gathering Physical Memory Usage Of A Started Process Tree
Mar 21, 2012
first of all, I'm not 100% sure this is the right forum to post this, as there seems ot be tones and tones of forum branches here, so if I'm not in the right location, i'm creating an IDE for a proamming language and I need a way to monitor the physical memmory usage of a process tree. I'm not talking about the WorkngSet64 of a process, but the WorkingSet64 of the process and any child process started by it.
I've noticed that every time I start a new thread in my program, the memory usage jumps about 1000k and it never goes back down. I have ensured that the thread is no longer running, and only one instance of my worker thread is ever running at a time. I am using ThreadPool.QueueUserWorkItem and ASyncOperation to get stuff done. The program starts using a Sub Main in a module that uses STAThread; I read that using STAThread instead of MTAThread makes it impossible for the Garbage Collector to get in and consider objects for garbage collection. However, when I change the STAThread to an MTAThread, the WebBrowser control in my frmMain cannot be instantiated.
I get this exception:
Code: An unhandled exception of type 'System.Threading.ThreadStateException' occurred in System.Windows.Forms.dll
Additional information: ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment. I do threading with the WebBrowser control, so will using MTAThread fix my problem? If so, how should I partition my code so that the WebBrowser control won't be affected by the above exception? I call the thread repeatedly with a timer (although only one instance ever runs at a time), and my program's memory usage starts at about 5000k and can jump to 300,000k+ depending on many times the thread needs to be called.
I'm trying to pull the total physical memory on a machine and have it show just like it would inside My Computer Properties.
I know I can use My.Computer.Info.TotalPhysicalMemory which will return it in bytes. This is where I'm getting stuck. I want to be able to divide it and then truncate it to where it would show like My Computer Properties would report it.
I've created an app that calculate calories that the user ate that day. They first enter breakfast, then lunch, then dinner, but the totals all open in one page and if they close that page, they lose their totals. How can i get the totals to stay on the physical memory until the user closes the whole app?
how to write to memory some data and then read it back?
If i have 1GB free of memory i would like to write 100MB to memory some data and then read it back, i searched net for some documentations but cant find nothing, only writing to other process and some stupidities!
VB.net 2010 Read all around the net, but cannot seem to do this: Tried the performance counter Categoryname=process Instancename=("program"). _Total helps in part- but it would be more efficient to acquire the main applications cpu usage for this project.
Code:for each p as process in process.getprocesses if p.id=process.getcurrentprocess.id then end if next 'Values, Obviously multiple processor cores have to be taken into account'kernelmodetime, usermodetime, Cputime, total cpu time, 100% <-- Does this involve adding and or dividing all these times? I need the current process CPU usage.
I am trying to create an app that will perform actions on specific times (much like the Windows Task Scheduler). I am currently using Process.Start() to lunch the file (or exe) required by the task. I am initiating a process by calling a file (an .mp3) and the process starts WMP (since it is the default application), so far so good. Now I wan't to kill that process. I know that it is normal behavior for the Process.Start(string, string) to return nothing (null in C#) in this case. So I am asking how can i close WMP when I called it through Process.Start(string, string)??
i am a beginner in vb.net programming...started a project in it.Below is the breif project description.The application is to ensure the integrity of the files.Following are the majors things that i have to implement
1. To browse the files from the disk on runtime.initially i am just taking the database files so it's basically to connect with the MS access db files.
2.To apply the different hash and encryption algos on the file.
3.To store the results on the hard disk back.
4. To calulate the performance of each algo using some performance matrix.(TIME,MEMORY USAGE etc)
Now i am having problem in two things.First in runtime connectivity with MS access batabase..and secondly and the main problem is that i could'nt find any appropriate builtin function to calulate the processing TIME and the MEMORY usage.
Having a problem with the amount of memory being used going up and up, and expanding until there is no memory left. I'm using the GHeat.Net plugin to build images. Here is the full code:
Dim pm As New gheat.PointManager() Dim g As Graphics Dim startZoom As Integer = 2
I want to know if there is a way to get each new process (what has been started) in a real-time manner (instantly). I tried until now something like:
1. Getting the number of opened/running processes
2. If the number is different from the previous check then the program is scanning each process (what is running) using a timer, each process has assigned its "pid" (using array) -- so if there is a new "pid" the process will be scanned -- else the process will be skipped. (scanning: getting its "object" path and creating a md5 signature etc.) This is working but is inefficient(very)...
You can easily get the memory usage of the current process using workingset64 However I could not find any event like OnMemUsageChanged so I can display a little mem usage meter that displays live/real time the mem usage value. Updating in a timer every second can be done but looks inefficient. Is there anyway I can get an event or callback every time the mem usage changes ?
i have two forms : Form1 and Form2..when i start application form 1 opens up, the memory usage is 10MB then i open form 2 and close form 1, the memory usage is 25MB.Again i close form2 and open form1, then the memory usage is 30MB.Why is this so that form 1 has different memory usage at different times...?
so im about half way through with rebuilding my fav project in vs2008 (old code was in vb6) and today was a great milestone for me as i got to test out all its limbs (whats missing is still the brain). Most of the code is completely new, even tho it has roughly the same structure .net framework has replaced the majority of api calls and everything has been reoptimized for performance.Now when i ran the complete systems check i was pleased to find that everything functioned without fail and the entire thing took only third of the time then the equivalent on vb6. What was shocking however was the memory usage when i popped open task manager i saw it hogging up to 4gb of ram and then dropped like a stone to 100k, again up to 4gb and down to 100k like a themepark ride the vb6 version never went above 46k so this is odd for me. While it doesent cause any direct problems on this comp, im afraid it might hurt the performance on the end system im going to run it on.
I'm programming a windows services that is in charge of generate reports based to users request.for each user request I create a thread with next code:
hiloSolicitud = New Thread(AddressOf GenerarReporte) hiloSolicitud.Start()
wherein GenerarReporte is a method that generate a report. I used threads because there are many users request.My problem is that when windows services has many users request the memory usage is to up 2 GB.that's the rest of memory possible, without count the memory for Operating System.In this case the windows services doesn't process any more request or reports because haven't more memory to work.so that when there are requests for large memory usage are processed but also allow the service of process windows of less use.I Want to limit memory usage for each thread.
whenever i start my app and let it start a process, and the process dies or gets killed my app goes down too. but this only occurs when i'm debugging, not when i run the program
I have searched the www but so far cannot see how to do it. Perhaps via a try/catch statement?
How can I test if a process can be started in vb before actually starting it, e.g. when I use process.start("<name>.exe") ....
but before doing that I would like to make sure that it will be callable.. is this possible at all? maybe by using some kind of My.Computer .FileSystem .FileExists ("<name>.exe") statement?
I have a small-scale WPF application using VB.net as the code behind and I want to add certain features, but i'm concerned about performance.
1) My app interacts with a third party database to display "realtime" data to the user. My proposed method is to create a background worker to query a database every 30 seconds and display the data. I query about 2,000 records all long integer type, store them in a dataset, and then use LINQ to create subsets of observable collections which the WPF controls are bound to.
Is this too intensive? how much memory am i using for 2,000 records of long int? Is the background worker querying every 30 seconds too taxing? will it crash eventually? Will it interfere with the users other daily work (excel, email, etc)?
2) If an application is constantly reading/writing from text files can that somehow be a detriment to the user if they are doing day to day work? I want the app to read/write text files, but I don't want it to somehow interfere with something else the person is doing since this app will be more of a "run in the background check it when I need to" app.
3) Is there a way to quantify how taxing a certain block of code, variable storage, or data storage will be to the end user? What is acceptable?
4) I have several list(of t) that I use as "global" lists where I can hit them from any window in my application to display data. Is there a way to quantify how much memory these lists take up? The lists range from lists of integers to lists of variables with dozens of properties. Can I somehow quantify how taxing this is on the app or the end user?
I have started with a small project in VB2008 Express which grew to a complex application. I have deployed the application recently discovering it is rather small, and the major issue is that code-generated controls (checkboxes, comboboxes, textboxes) are not displayed as during development. I have declared the code-generated controls in the declaration region, and there are about 250 controls. According to user selection some of the controls are added to a container panel. Now, I am concern that because I declare those as public (static?) variables, it uses much memory and causes the problem in the compiled application. Is that correct that static declared and code-generated controls uses much memory? How to avoid it ? I need the controls as public variables. Is it better to add all 250 controls on the form in designer mode, and use the property Visible (control.visible=True)?
I am trying to setup performance counters for CPU Usage and Memory Used.I would like a progress bar and a label to display the percentage.I have the below code and although it seems to be half working, there is something just not right.. The memory one seems to be working fine although the CPU one is acting strange.
I saw some 'offsets' such as: 0x006E71A0and some that were like, Game.dll+8E336CI'd more so think the 0x006E71A0 and the Game.dll+8E336C are among the same format, so i'd like to use that.I have also read somewhere(this could be wrong) that the memory addresses formats are different between VB, C#, and C++.
i wanna know for example if you have a few functions that actually creates a new sqlcommand in it and disposes them after use or is it better to have an sqlcommand at the main function and pass the sqlcommand in byref . and after using it. Juz clear the commandtext and the parameters.[code]
I have a fairly complex application which makes use of an MS Access database. My application generates some 14million entries and inserts them after each generation, into the database. The app works perfectly without any bugs(that I am aware of) apart from one problem. If I run the app and let it run the full 14million odd data entries, the app crashes some way through and gives an Out of Memory exception.
I then loaded up TaskManager and notice that the memory usage increases by about 8-15Kb per second. I have done some reading and have tried using Dispose() to get rid of any objects finished with, I have tried building in release mode and the problem remains. I'm not even really sure if it is a memory leak or something else. I am using VS2010 and my application is running in .net 4.0.
I have an ArrayList that stores 100,000+ numbers inside of it. Each number is 10 digits in length or smaller. The program itself has data input into it, of which it loops through the user input to see if any of their numbers are already in the array using if ArrayList.Contains(userinput).
It would appear that when having an ArrayList of this size a LOT of memory is being used. Would there be a faster way to run this, E.g. Database or If TextFile.Contains(Line)?
Does a the size of the class affect the memory usage of the application? is it better to break big classes into smaller classes or just group them up into one big class.