• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.
  • The forums have been upgraded with support for dark mode. By default it will follow the setting on your system/browser. You may override it by scrolling to the end of the page and clicking the gears icon.

Solution: Kill processes when getting out of memory!

Joined
Feb 18, 2009
Messages
1,825 (0.31/day)
Location
Slovenia
System Name Multiple - Win7, Win10, Kubuntu
Processor Intel Core i7 3820 OC@ 4.0 GHz
Motherboard Asus P9X79
Cooling Noctua NH-L12
Memory Corsair Vengeance 32GB 1333MHz
Video Card(s) Sapphire ATI Radeon RX 480 8GB
Storage Samsung SSD: 970 EVO 1TB, 2x870 EVO 250GB,860 Evo 250GB,850 Evo 250GB, WD 4x1TB, 2x2TB, 4x4TB
Display(s) Asus PB328Q 32' 1440p@75hz
Case Cooler Master CM Storm Trooper
Power Supply Corsair HX750, HX550, Galaxy 520W
Mouse Multiple, Razer Mamba Elite, Logitech M500
Keyboard Multiple - Lenovo, HP, Dell, Logitech
Solution: Kill Processes when getting out of memory! (UPDATED)

SOLVED:

http://www.mediafire.com/?jtq80zg7g85ut5i



--------------------------Original Post:

Is it possible to kill a process when on a TASK MANAGER event or Perfmon event.

Say that i make a new custom counter in perfmon based on COMMIT CHARGE and that counter would always ran in the background.

So when the counter reaches above the limit i set in script , it launches actions , in this case kills some specified processes.




In the same time , i want to increase the UI-specific limit that is about this warning coming up, i think i saw it and it can be set in Registery, but i forogt so you guys can help me out in the meantime im gone.

The warning is fine, just getting rid of this annoying popup should be necessary
2ry4ls5.jpg



And replacing it with a custom error message, or modifying this one (backup/duplicate), that would also have this exclamation point and some text but only A BIG OK button so it's like informing me, and not asking me stupid things i never want to do, and so I don't have to SPEND 3 HOURS:rolleyes: pointing my mouse to hit the cancel button. ( well im not upset i just have enough, baring it for a long time now)



I have a great plan in my mind about the levels of low-memory increasing and even a sound alarm ! , just need to know if this is possible and then get into details what that script's has to do.


This is important to me since i don't run pagefile and many times i do photo editing (well, minor stuff) happen to get over the 6 GB RAM and ... once i just forgot , started up COH and bam 10 programs crashed and even ATI drivers.

EDIT: Oh an these popups must not have focus command, so it doesn't throw me out of the full screen aplication, the sound alarm would be a good replacement for that.
 
Last edited:
haven't tried yet , will tomorrow


EDIT: Trying now, i doubt it , but i see it has some "process limits" and schedulers
 
Last edited:
I doubt this will work, since i need TOTAL commit charge , and then i need to close only specific processes.

processlassocommittermin.jpg



I don't need to monitor all processes , nothing, just the total commit charge and from there i kill processes no matter anything else.

It's a wrong methodology for me, since the processes monitored are the ones getting closes so if i selected ALL possible processes on my system then all of them would close down effectively making PC to shut down lolz
 
Last edited:
Maybe I don't understand, but process watchdog lets you name any individual process you want to control. I did this to monitor the old version of firefox and kill it once memory usage was over 1.5gig.
 
Nope , i don't need this.


Look here , i found something http://justgeeks.blogspot.com/2009/05/monitoring-commit-charge-in-windows.html

As it turns out WMI makes it extremely easy to do this. Below is a snippet of C# code that brings up an alert when Commit Charge > threshold.

public static void CheckCommitCharge()
{
System.Diagnostics.PerformanceCounter perfCounter = new System.Diagnostics.PerformanceCounter("Memory", "Committed Bytes");
long commitChargeInMB = perfCounter.RawValue / 1024 / 1024;

long threshold = 1900;
if (commitChargeInMB > threshold)
{
MessageBox.Show("Your system may become sluggish if you don't close some applications. \r\nThe Commit Charge is " + commitChargeInMB + " MB, but it should be below " + threshold + ".");
}}


All i need to do is to improve the script to add more "levels" or warn , so it first warns me , and then it would close only certain processes for me which i will specify.

The processes i chosen are:
plugin-container.exe
searchIndexer.exe
jusched.exe
sidebar.exe
searchProtocolHost.exe
realsched.exe
searchFilterHost.exe
NokiaMServer.exe
ISUSPM.exe
IAStorIcon.exe


Those processes will never get over 6 GB combined , but they will clear just enough when im doing some stuff with other programes which are CRITICAL to my work and ofcourse shouldn't be killed obviously.

plugin-container.exe being the largest at over 500 MBs as it's part of the resource hog Firefox 3.6, others are update and standby services.

Those processes are not critical and Firefox can function without plugin-container which is a very unoptimized and pretty much every youtube video gets hogged in there and badly cleaned.

This is a great solution as i always have a lot of browser windows opened when im doing something else ...


EDIT: Started a project in VC and i would be glad anyone with C# offer their tips. If somebody knows C++ and C# and knows an better or easier way in C++ that would work too, even better.
 
Last edited:
That's out of my league. I used the virtual memory trim function of process lasso for whole system memory management. It says not to use it but it always worked well for me and never caused any problems. I stopped using because I couldn't get tuned right for my purposes.

But you're right, PL is geared more to individual processes. It does have system wide functions too but I couldn't find anything that does what I think you want. Sorry.
 
I will report later what i came up with. just need to figure out C# a bit and also find examples on net.


EDIT: it's getting along nicely ... will share it when it's done
 
Last edited:
So i got the info on how to disable that annoying win7 official "close programs" low-memory popup:

http://thehotfix.net/forums/index.p...-memory-dialog-box-in-windows-os/page__st__20

For those who wish to completely disable the RADAR diagnostic module on Windows 7, to stop Windows from showing low memory dialogs and shutting programs down automatically:

Here are the registry keys that need to be taken over, and deleted:


HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WDI\DiagnosticModules\{3EA6B3DF-393E-41C3-9885-29EC5A701926}

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WDI\DiagnosticModules\{45DE1EA9-10BC-4f96-9B21-4B6B83DBF476}

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WDI\DiagnosticModules\{5EE64AFB-398D-4edb-AF71-3B830219ABF7}

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WDI\DiagnosticModules\{C0F51D84-11B9-4e74-B083-99F11BA2DB0A}

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WDI\DiagnosticModules\{E4CD2E3E-3852-4952-B76B-23BB8E35D344}


This will prevent radardt.dll (detection) and radarrs.dll (resolving) from loading at boot.


Making that into the program ... is another thing.
 
Last edited:
Going fine ... , however don't know to implement this registery tweak in C#, that's gonna take some research. Couldn't find such command in MSDN
 
Last edited:
I use windows server 2008 and it has something built in called windows system resource manager and It does stuff like the OP said. I used to use it for IE to control bloat but I have mine set to allocate certain amounts of CPU per share currently. However I did disable it for now and will re-enable it later.

if you have 2008/R2 it will work on those and if you use 2003 you can download a pack that has it.

for other OSes process lasso works.
 
I know I'm out of line probably for bringing this up, but if it's such a pain in the ass to get around this problem, wouldn't it be easier to buy more memory? Unless you want DDR3-1600 with CAS7 or something, it's pretty damned cheap. Just curious. Thanks.
 
They want to minimize commit charge, however you can just buy more RAM and then make the commit charge size really low like 4 or less GB. I leave mine at 6GB becuase PS uses tons of CC.
 
They want to minimize commit charge, however you can just buy more RAM and then make the commit charge size really low like 4 or less GB. I leave mine at 6GB becuase PS uses tons of CC.

OK, probably a stupid question, but why? Honestly, I've always been pretty fuzzy on what cc was anyway. I even looked it up just now and it still doesn't make much sense to me.
 
mine is like 2.6GB/6.0GB. Just having 32 Fx tabs open and MJ and one explorer window. That's why people obsess over it so much. We wanna keep it down to be easier on our HDDs.

I I open PS it shoots up to almost 4 total. and when I work with PS for an hour it shoots up to almost 5GB!
 
mine is like 2.6GB/6.0GB. Just having 32 Fx tabs open and MJ and one explorer window. That's why people obsess over it so much. We wanna keep it down to be easier on our HDDs.

I I open PS it shoots up to almost 4 total. and when I work with PS for an hour it shoots up to almost 5GB!

OK, that still doesn't tell me what it is. The impression I'm getting is that regardless of how much memory you have, a certain amount is going to end up on the pagefile, but not to be rude, that makes even less sense than anything I could have imagined. I thought the pagefile was only used for overflow. I mean a lot of people get by with no pagefile at all. I don't think it's a good idea, but it is a fact. At the same time, I know that even with 16gig I still see the pagefile being used. So I'm afraid I'm still quite confused. Not that this is your problem or anything ofc.
 
I can't just buy memory - i have 4 slots and only 2 GB are left to go (that would need replacing two 1GB sticks)

And i don't have reserved to spend for a new PC because this is more than enough what i honestly need.

Buying more ram at this point would just be estethical to suck those last percents of performance is not really worth the price, atleast for me.

If i buy ram i always buy the high quality RAM and that's not - that's probably one of the components i never heistated to doubt about "is it going to be worth it" --- because all the cheap ram is so freaking problematic.

Plus i have DDR2 so no more ram for me since DDR3 replaced with lower prices. Which means high price for DDR2


This may only happen if i ever come across an affordable yard sell of 2x2GB Corsairs somewhere ... but im not going to buy em new full price.
 
I guess memory prices are a lot different where you are. Here you can get sticks of 2gig Mushkin enhanced silverline for $28 each. So $56 total.
Computer Hardware, Memory, Desktop Memory, DDR2 8...
But even that can be more than what you might want to spend. I spent most of my life as a poor student so I definitely understand.

Another idea i had was to increase the size of your page file. Do you know what it is currently set to?
 
I guess memory prices are a lot different where you are. Here you can get sticks of 2gig Mushkin enhanced silverline for $28 each. So $56 total.
Computer Hardware, Memory, Desktop Memory, DDR2 8...
But even that can be more than what you might want to spend. I spent most of my life as a poor student so I definitely understand.

Another idea i had was to increase the size of your page file. Do you know what it is currently set to?

Everything in tech is more expensive here already

Then the crappy euro spices it up also.



The point is - i don't want pagefile for a reason - other people around here mostly know my big arguments about that so i don't need to repeat it all over again.
 
Everything in tech is more expensive here already

Then the crappy euro spices it up also.



The point is - i don't want pagefile for a reason - other people around here mostly know my big arguments about that so i don't need to repeat it all over again.

OK, so to summarize, you don't want to use a page file on aesthetic/moral/philosophical grounds and you don't want to buy more ram. Your prefered method of dealing with the problem is to find or write a windows hack that bypass it's low memory warning by killing specific processes you designate when the memory warning is or is about to be invoked.

Is that more or less accurate? If it is, that's cool. If that's what you want, then go for it. I just need to know so I can unsubscribe from the thread. So, thanks in advance.
 
The point is - i don't want pagefile for a reason - other people around here mostly know my big arguments about that so i don't need to repeat it all over again.

Sorry Ruski, but this seems a weird way to run your PC and I don't get it at all.

So, you've got 6 gigs in it, which is an awful lot. However, the amount of resources needed to run your programs exceeds even this large amount of memory. So, you don't buy more RAM, but instead wanna kill off random processes? What? This sounds like a recipe for instability and disaster. :shadedshu

I'd really like to know why you're so against virtual memory. Fair enough, don't explain it all again, just point me to a post where you've explained this before and I'll gladly read it and talk with you about it.

OK, so to summarize, you don't want to use a page file on aesthetic/moral/philosophical grounds and you don't want to buy more ram. Your prefered method of dealing with the problem is to find or write a windows hack that bypass it's low memory warning by killing specific processes you designate when the memory warning is or is about to be invoked.

Is that more or less accurate? If it is, that's cool. If that's what you want, then go for it. I just need to know so I can unsubscribe from the thread. So, thanks in advance.

As you can see, I'm not the only one who find this strange and even twilyth who helped you quite a lot here is put off in the end.

Windows, especially Win7, is designed to work with a pagefile and even if it's switched off it'll still use a stub. I dunno why, but I guess a TechNet knowledgebase article might explain it. This tells us that Windows is totally geared for it, so choking it off is a really bad idea.
 
Last edited:
Sorry Ruski, but this seems a weird way to run your PC and I don't get it at all.

So, you've got 6 gigs in it, which is an awful lot. However, the amount of resources needed to run your programs exceeds even this large amount of memory. So, you don't buy more RAM, but instead wanna kill off random processes? What? This sounds like a recipe for instability and disaster. :shadedshu

I'd really like to know why you're so against virtual memory. Fair enough, don't explain it all again, just point me to a post where you've explained this before and I'll gladly read it and talk with you about it.



As you can see, I'm not the only one who find this strange and even twilyth who helped you quite a lot here is put off in the end.

Windows, especially Win7, is designed to work with a pagefile and even if it's switched off it'll still use a stub. I dunno why, but I guess a TechNet knowledgebase article might explain it. This tells us that Windows is totally geared for it, so choking it off is a really bad idea.

There's nothing against Twilyth - when i found the justgeeks.com code sinppet i was geared enough i though i could try it my self since i already have VSC++ installed.


Don't worry about pagefile ... i will point you to the explanation thread so i don't have to rewrite a lot because it's ... a lot.

There's very little people beliving me or the other guys who are also anti-pagefile.

In a quick summary: I installed windows 7 in July last year, before that i was on a test install which was very bugged i just used it to learn win7 for a few months prior that.

It was a clean install - had everything in plan - new ram - good bios settings - everything optimized and not overclocked - run memtests and prime95.

I haven't run with a pagefile for a year now ... and i haven't experienced a single crash or freeze randomly in windows. It's 100% positive things , the UI is super responsive , everything loads faster into memory , faster boot , my PC is so much stable and optimized it never way any year before since i assembled this custom machine in 2008. Mobo, PSU, and CPU stayed the same til today, everything else upgraded and sound card added (HUGE difference over integrated OMG! - and the industry says "CPUS are fast enough for sound today" - that doesn't really help nor has any sense - it's about the sound hardware quality - all those filters and chips.)

Except the purposely made freezes and crashes because i was testing Starcraft 2's memory management and found that their engine is very leaky.


This program i am going to make will finally solve what i needed for the final touch to make it a non-issue. Which was constantly having to be aware of memory status and being careful.

Basically - i cannot close stuff down what i need and sometimes it get's a lot - especially video and photo editing (amateur) as well as modding.

running firefox (1GB) , VCC++2010 , photoshop (2GB) , explorer windows , other programs ... in relatively rare situations it gets to the limit when i don't restart the PC for a few days - get's hooged up to 6000 MB and i just close those annoying win7 warning which is asking me to close down a program that i actually NEED . (just selects the highest working set or commit requirement exe)

Why would 6GB sound a lot - every other programming or modding geek has 8GB Ram machines and photo and video editing at 16 GB workstations.
Im actually lowest on the scale :p


So ... i forget about it ... i do some more stuff , maybe friend calls me to play Company of Heroes multiplayer and ... bam the PC crashes or most of the drivers just close but Win7 kernel and important stuff apparently is very deep inside RAM ... never got a BSOD or anything erratic.

This program will run in bacground ... when ever total system memory requirements get to a set threshold it will kill user-selected processes to free up needed memory.

If you have a Pagefile of 6 GB ... that's 12 GB and in that case it's so much more memory , but why i don't like pagefile is obvious - a 100MB/s hard drive is not a substitute for 3000-6000 MB/s RAM. The whole logic around that is only as a feature to provide in low-memory environiments and other critical places where PERFORMANCE is NOT needed but rather FLEXIBILITY. I choose performance :)

Windows doesn't need pagefile to operate - you can put the whole windows kernel onto the RAM even if you have pagefile enabled - by setting the registery value DisablePagingExecutive to 1.


That's that ... just let me find the links to the pagefile discussion, there is more than one thread.

Also i just neede help at the beginning because i dind't know such stuff exsited until i taken things into my hands and that's what i strive for - i don't give up easily - and if you can't find it - make it your self :) (that's should apply for this what im going to do for a living heh - as far as programming goes)


Also in the recent years i disovered how many bullshit sites are there on the internet that just have no idea about the system and techinal stuff and are just popup sites that have some "3 steps to speed up PC 400%" ads spam and fake program promo sites ... there are also some genuine-looking blogs/articles with people who think they're smart but mostly when i tried to follow the instructions i realized how wrong they were. But i found many genuine stuff as well - that really takes some time to find.
 
Last edited:
disabling the page file is silly even if you have a lot of RAM.

if you think you can outsmart the OS, you're probably in for a losing battle. it was almost always do a better job managing things than you will.
 
There's nothing against Twilyth - when i found the justgeeks.com code sinppet i was geared enough i though i could try it my self since i already have VSC++ installed.


Don't worry about pagefile ... i will point you to the explanation thread so i don't have to rewrite a lot because it's ... a lot.

There's very little people beliving me or the other guys who are also anti-pagefile.

In a quick summary: I installed windows 7 in July last year, before that i was on a test install which was very bugged i just used it to learn win7 for a few months prior that.

It was a clean install - had everything in plan - new ram - good bios settings - everything optimized and not overclocked - run memtests and prime95.

I haven't run with a pagefile for a year now ... and i haven't experienced a single crash or freeze randomly in windows. It's 100% positive things , the UI is super responsive , everything loads faster into memory , faster boot , my PC is so much stable and optimized it never way any year before since i assembled this custom machine in 2008. Mobo, PSU, and CPU stayed the same til today, everything else upgraded and sound card added (HUGE difference over integrated OMG! - and the industry says "CPUS are fast enough for sound today" - that doesn't really help nor has any sense - it's about the sound hardware quality - all those filters and chips.)

Except the purposely made freezes and crashes because i was testing Starcraft 2's memory management and found that their engine is very leaky.


This program i am going to make will finally solve what i needed for the final touch to make it a non-issue. Which was constantly having to be aware of memory status and being careful.

Basically - i cannot close stuff down what i need and sometimes it get's a lot - especially video and photo editing (amateur) as well as modding.

running firefox (1GB) , VCC++2010 , photoshop (2GB) , explorer windows , other programs ... in relatively rare situations it gets to the limit when i don't restart the PC for a few days - get's hooged up to 6000 MB and i just close those annoying win7 warning which is asking me to close down a program that i actually NEED . (just selects the highest working set or commit requirement exe)

Why would 6GB sound a lot - every other programming or modding geek has 8GB Ram machines and photo and video editing at 16 GB workstations.
Im actually lowest on the scale :p


So ... i forget about it ... i do some more stuff , maybe friend calls me to play Company of Heroes multiplayer and ... bam the PC crashes or most of the drivers just close but Win7 kernel and important stuff apparently is very deep inside RAM ... never got a BSOD or anything erratic.

This program will run in bacground ... when ever total system memory requirements get to a set threshold it will kill user-selected processes to free up needed memory.

If you have a Pagefile of 6 GB ... that's 12 GB and in that case it's so much more memory , but why i don't like pagefile is obvious - a 100MB/s hard drive is not a substitute for 3000-6000 MB/s RAM. The whole logic around that is only as a feature to provide in low-memory environiments and other critical places where PERFORMANCE is NOT needed but rather FLEXIBILITY. I choose performance :)

Windows doesn't need pagefile to operate - you can put the whole windows kernel onto the RAM even if you have pagefile enabled - by setting the registery value DisablePagingExecutive to 1.


That's that ... just let me find the links to the pagefile discussion, there is more than one thread.

Also i just neede help at the beginning because i dind't know such stuff exsited until i taken things into my hands and that's what i strive for - i don't give up easily - and if you can't find it - make it your self :) (that's should apply for this what im going to do for a living heh - as far as programming goes)


Also in the recent years i disovered how many bullshit sites are there on the internet that just have no idea about the system and techinal stuff and are just popup sites that have some "3 steps to speed up PC 400%" ads spam and fake program promo sites ... there are also some genuine-looking blogs/articles with people who think they're smart but mostly when i tried to follow the instructions i realized how wrong they were. But i found many genuine stuff as well - that really takes some time to find.

to me it sounds like you're fighting with windows when you'd be much happier on linux.
 
Back
Top