Kill Idle Process



  • 1. Memory Usage and Page File Usage - Help!
    Hi, I am building a windows application that has a feature that retrieves a set of records when a button is clicked. When the records are being retrieved I experience a complete system degradation, including other programs that become unresponsive. Here's what I found while the retrieval process is running: Using the Windows Task Manager, I can see the the "Page File (PF) Usage" indicator under the Performance tab increase in value from 360 MB to over often over 1 GB when returning 3000-6000 records. The "Mem Usage" indicator under the Processes tab increases from 40,000K to over 300,000K. When the operation is done, the memory usage levels remain the same and the response time for my whole computer remains slow. Only until after the application is closed does the memory usage levels go back down and my computer returns to its normal response time. Also, I'm not sure if this matters but the table that contains these records has a column of type "text" which may contain data in the size of 100-5000 characters. Any help on what is going on and suggestions on how to fix this would be appreciated. Thanks!
  • 2. VB program and EXE
    I am very new at this type of situition and am looking for guidance: I am using VB.NET 2002 to write an app. I have an .exe that needs to be incorporated into my program. It's an RSYNC(novell synching utility)exe I am going to get a job number and year from the user. This will allow me to build a string of where the file is stored in the directory. Once I build the string I am going to run a shell command from within my program such as: c:\cwrsync\rsync.exe -vaz /cygdrive/c/TrussJobs/....etc c:\cwrsync\rsync.exe (<--The exe I need to run) Is there a way to store this file in a VB.NET program when compiling and then copy it to the user without them knowing it when the form is loaded so it is in place upon submission? OR Is there a way to store an .exe in the program and when trying to process the shell I can locate it somewhere? So- in recaps, I need help distribuitng an exe to the user in order to get my shell command to work properly. This is not being used for corruption but to save my users from needing to terminal in to our central location and copy data. RSYNC can handle the copying of data for us freeing up a lot of time and reducing bandwith greatly since it compresses on the fly. Thanks for any suggestions!
  • 3. Exception properties
    I am trying to create a generic logging component that will accept an exception object and create a string containing all the properties and their values available for a specific exception. My intent here is try to create a generic function that will be able to: - Take a an object of type Exception... - Iterate through all the properties the object has... - Add the property names to a stringbuilder... - Call each of the properties and get the values... - Add each of the values to the string builder. I can get all the basic properties that System.Exception provides (Message, Source, Inner Exception, Target Site, Stack Trace, etc...) but I would also like to be bale to get any customer properties provided by the more specific exceptions and also print them out. Can anyone point me to a piece of code that will help? I would also like to be able to print the specifics on custom exceptions that are not part of the framework but I am thinking that I am not going to be able to get much deeper than the standard properties provided by the base exception the custom exception inherits from. Any ideas out there?

Kill Idle Process

Postby jgaull » Sat, 20 Dec 2003 04:04:05 GMT


We have a limited number of licenses to some software we have
installed on our users desktops.  The problem is that sometimes the
users open up the application and then don't use it all day.  This
prevents others from being able to use the application because we run
out of licenses.

I'm thinking that we want to create a windows service using VB.Net
that we will run on everyone's machine and have it monitor this
application to see if it is idle for too long.  If it is idle for too
long, we will then kill it and pop up a message to the users letting
them know what we did.  Does anyone have any ideas?  Any sample code?


Re: Kill Idle Process

Postby Jared » Sat, 20 Dec 2003 06:48:36 GMT

Hi, this isn't a code solution, but, have you even looked into Terminal
services? You can disconnect idle users automatically. I don't know what the
licensing is so you will have to look into it. Just a suggestion.

Re: Kill Idle Process

Postby Ot » Sat, 20 Dec 2003 22:34:40 GMT

So you want to have an application that

a) scans all the running processes
b) for an identified subset of those, determine how long each has been
c) stop those whose idle time exceeds a threshold and
d) inform  the user you have done so with a friendly message.

A pretty puzzle, and I hope some guru or other can help you.

I found some interesting stuff in System.Diagnostics.Process.  If I am
reading that correctly, you can find the processes and their names (a).
You can find their state (e.g. idle in ProcessPriorityClass), but I don't
see an idle time in that class.

If you had a thread that checked the state every few seconds... but the
problem I see is that it may have gone un-idle and back to idle in the
interim.  I suppose you could check resource usage -- TotalProcessorTime -- 
and if it is unchanged for the time period...

In any case,

Good Luck!

Re: Kill Idle Process

Postby Chris Dunaway » Wed, 24 Dec 2003 02:46:16 GMT

Perhaps there are some classes in WMI that would provide a means of
determining the apps idle state.  Perhaps the WMI could be polled at
regular intervals and if the process's state had not changed, then take


To send me an E-mail, remove the underscores and lunchmeat from my E-Mail

Similar Threads:

1.How to kill a child process when kill the parent process

I'm doing a c# web application. It create a process "A" to
excute an .exe file. This exe file is compiled from c++. In this exe
file it will create another new process "B" to excute another .exe
file. (This one is VB, but I think this doesn't matter). What I want
to do is when I kill the first process "A" from c#(usill kill()
function) I want to kill the child process "B" at the same time.
If all is in c++ maybe I can figure it out but in this case I totally
have no idea. Any help will be appreciated.



Return to VB.NET


Who is online

Users browsing this forum: No registered users and 8 guest