Solved

VB limit itself to X CPU usage and ram usage

Posted on 2010-09-09
9
404 Views
Last Modified: 2012-06-27
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
0
Comment
Question by:gb874554
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 12

Expert Comment

by:GMGenius
ID: 33637453
Open your project properties page, then select the compile tab
Click on Advanced Compile Options, you can select the Target CPU there
0
 
LVL 12

Expert Comment

by:GMGenius
ID: 33637463
In .NET 2008 you can also choose the framework
I dont know how you can limit the RAM usage though
0
 
LVL 30

Expert Comment

by:MlandaT
ID: 33642023
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
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 
LVL 30

Expert Comment

by:MlandaT
ID: 33642032
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
 
LVL 12

Expert Comment

by:GMGenius
ID: 33642241
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
 
LVL 5

Expert Comment

by:andr_gin
ID: 33645699
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
 

Author Comment

by:gb874554
ID: 33670866
What is the best way of setting a RAM usage maximum for an application? (in VB.net)
0
 
LVL 12

Accepted Solution

by:
GMGenius earned 500 total points
ID: 33672015
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
 

Author Closing Comment

by:gb874554
ID: 33774428
That is right, it seams it can not be done. Thanks anway.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question