Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to monitor system resources and prevent a crash?

Status
Not open for further replies.

Jtorres13

Technical User
Nov 11, 2006
162
0
0
US
How to monitor system resources and prevent a crash? Let's say I want to monitor Winword.exe and if it consumes too much memory (random number of RAM, chosen by me), I want to save the document and alert the user Word will be closing in 30 seconds, then actually force Word to close.

Is this doable? I mean doable in the sense that I can actually execute a program that does this? I'm not considering factors like "maybe the user doesn't want to close at that very moment", "why would I want to do this?", etc...
 
Of course it is doable.

Is it easy and straightforward? No. Is there a point to it on a multitasking, paged-memory system? Probably not. But here's an overview

1) Enumerate all the processes your application is using
2) Call GetProcessMemoryInfo ( for each of those processes
3) Figure out the totals
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top