VB limit itself to X CPU usage and ram usage

Hello,

i would like to know how to have a VB.net software to limit itself to X CPU usage and ram usage. How can this be done?

Thanks
gb874554Asked:
Who is Participating?
 
GMGeniusConnect With a Mentor Commented:
I dont believe you can, the only option is as mentioned above , you have to ensure you code your application carefully
 
I suggest you take a read here
http://msdn.microsoft.com/en-us/magazine/dd882521.aspx 
0
 
GMGeniusCommented:
Open your project properties page, then select the compile tab
Click on Advanced Compile Options, you can select the Target CPU there
0
 
GMGeniusCommented:
In .NET 2008 you can also choose the framework
I dont know how you can limit the RAM usage though
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
MlandaTCommented:
I am not sure why you want to do this, however, for CPU usage, have a look at Processor Affinity settings http://msdn.microsoft.com/en-us/library/system.diagnostics.process.processoraffinity%28v=VS.90%29.aspx

Am not sure if you can do this for RAM
0
 
MlandaTCommented:
You may want to look at http://blogs.msdn.com/b/oldnewthing/archive/2005/03/21/399688.aspx which discusses various insights into what you are attempting to do (though mainly discourages it... almost)
0
 
GMGeniusCommented:
I have had to do this,
I had to set the Target CPU to x86 so when it was run on a 64 bit OS the underlying 32bit only DLL would work, without doing this the DLL failed to work
0
 
andr_ginCommented:
Only setting a RAM usage maximum for an application will only prevent a crashing application from using all the RAM of the machine and the application will be terminated with an OutOfMemory exception. If you want to stay below a defined limit and keep your application running, the application itself has to handle things like caching of data in a way that it uses not more than a defined value and swap not frequentyl used data to a temporary file.
0
 
gb874554Author Commented:
What is the best way of setting a RAM usage maximum for an application? (in VB.net)
0
 
gb874554Author Commented:
That is right, it seams it can not be done. Thanks anway.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.