[Note: v1.44 is online. Fixed a couple of typos. Fixed window sometimes popping up dead center instead of chosen corner. Added popup menu when left clicking on Tray icon. Download from here MemoryHogs]
While noticing how slow my browsing sessions at home could get, I thought it would be nice to try and monitor the situation and ‘diagnose’ what is going on. I use Firefox routinely, It is a one process browser and can grow to use a lot of RAM. I’m talking 900 megabytes, 1200 megabytes or more. And sometimes when it gets that high, it is a runaway process that needs to be killed. I highly recommend an add-on called “YouTube – Flash HTML5.” With it, you switch between Flash videos and HTML5 videos. Sometimes Flash just goes wild and crashes Firefox.
While searching for clues on writing an application to monitor processes, I came across the basic code for getting a list of process names, RAM usage, Path, etc. I created the basic program around that. I later saw some AutoHotkey code for a CPU Load graphical monitor. And I also read up on Win32_Process more. I filtered the list on only processes that have a window associated with them. Other processes are service or ‘background’ processes, for lack of a better word.
Currently, users can choose how many processes to display, the RAM and the CPU Thresholds, over which the Memory Hogs window will be displayed.
Memory Hogs can alert users of the following:
- When any process uses more than a certain amount of RAM.
- When any process is ‘Not Responding’ a Tray Tip window will be displayed.
- When the CPU Load is over a certain percentage.
- When free Disk space is below a certain amount.
- When Used RAM is above a certain percentage.
- When Used Pagefile is above a certain percentage.
- Item 1 will be checked if a process is over the threshold.
- Item 2 will be displayed at the bottom right corner if a process has been Not Responding for at least 9 seconds. This value can be changed in the settings file.
- Item 3 will flash the CPU Load when threshold is reached.
- Item 4 will only be displayed when the computer name is added to the settings file using the ShowDiskSpaceForPCsNamed variable matches the current computer. (Since fixed disk space is rarely an issue today this alert is not enabled by default.) [For some systems like Virtual Desktops, the amount of disk space may well be 10gb or less and free space would be important to track.]
- Item 5 defaults to Used RAM greater than 90% and will flash an alert.
- Item 6 defaults to Used Page File greater than 90% and will flash an alert.
Double-clicking a process will allow it to be killed. Right double-clicking will display the process folder in windows explorer. It can run in Stealth Mode and log these events for you to check later on.
Some screen shots and more information are below.
Double-click a process to Exclude it from the Not Responding tray alerts. Excluded processes will be highlighted like you have clicked them in the list. This is just a quick visual indicator.
Later on you can double-click the same process to Include it in alerts again.
The help instructions from the program are below.
Pressing ALF-F at the Main window will Freeze it so you can make changes to the numbers and double-click any processes to Exclude them from or Include them into the Not Responding alerts. Click Update then press ALT-F when you are finished to “Thaw” the display.
Added two more Memory alerts to the main window, Used Physical RAM percentage and Used Pagefile percentage.
Create a shortcut for the program with parameter, either s or S, and it starts in Stealth Mode with no visible output. (i.e. command line is memoryhogs.exe s)
Changed Refresh button to Update. Now you can change the values then click Update to see the effect without the program restarting. Pressing Escape key hides the window and set AlwaysShow OFF.
For processes that frequently go Not Responding you can Exclude them from showing alerts by double-clicking them and choosing EXCLUDE. They will be displayed as gray or highlighted color to denote Excluded. If your double-click them again you can choose INCLUDE and they will alert on Not Responding. Processes that go over the RAM Threshold displayed with a checkmark.
Users can click on the Tray icon to Show or Hide the main window now.
Added a limiter for Not Responding processes called aProcessSeconds. It defaults to 9 seconds a process has to be hung to display an alert. This is three times through the normal 3 second scan interval. This can be added to MemoryHogs.ini and changed there (i.e. aProcessSeconds=12 would be 12 seconds before an alert). This is to cut down on very brief Not Responding periods for processes which caused a lot of flashing popup messages in the system tray area. This number should be a multiple of 3 since the refresh cycle is 3 seconds between re-displaying the processes.
Memory Hogs v1.22:
A small program that lists processes when one or more of them are using more memory than a desired threshold. If the process is run away or frozen, left double-click it to close it. Right double-clicking will open the folder the process is running from. You can set the number of processes to list, the memory threshold then Refresh the window. The Home, End, Page Up and Page Down keys may be used to move the window quickly to any corner. You may also right-click on the program icon and choose Always Show to have the window remain visible even when no processes are over the threshold. The processes are updated every 3 seconds.
Added auto updater code
Added Stealth Mode to hide the program completely but log all types of activity. Previous Alert statuses are saved when going to and from Stealth Mode. You can type @mhoff to turn off Stealth Mode.
Added Hotstring commands to augment right-click menu for keyboarders.
@mhs – Show On/Off
@mhh – Hide (Show Off) or press ESCape
@mhi – Show Program Info
@mhr – Restart/Refresh
@mhca – CPU Alerts On/Off
@mhda – DISK Space Alerts On/Off
@mhra – Used RAM Alerts On/Off
@mhpa – Used Pagefile Alerts On/Off
@mhnra – NOT Responding Tray Tip Alerts On/Off
@mhvl – View Logs
@mhvs – View Settings
@mhas – AutoStart On/Off
@mhex – Exit/Quit Program
@mhon – Stealth On
@mhoff – Stealth Off
Use View Log Files to pull up each file into Notepad
Added Log All Alerts option to the menu. If selected, then CPU, Disk and Not Responding Alerts are logged into three separate files under c:\temp.
Program always alerts on Memory Hog processes but now has a menu for CPU, Disk and Not Responding Alerts that can be turned on and off.
Program has an AutoStart menu option now.
Some menu item name changes.
Optionally, if you set a PC name in the MemoryHogs.Ini file, the program will track free disk space and alert when it is too low. Set or add ShowDiskSpaceForPCsNamed to your computer name and you will see the window displayed if your PC has less than the desired diskspace.
Process Status is now displayed. Background (window less) processes are no longer shown. Active is good, Not Responding is bad if it persists.
The program starts in Always Show mode to set your initial values.
An additional alert has been added for CPU. If the CPU is 90 percent loaded then the window will be displayed and the CPU percent will flash. You can set the CPU Load as you like. Some text formatting changes have also been made. CPU Load is shown when the mouse is over the program tray icon.