Solved

VB limit itself to X CPU usage and ram usage

Posted on 2010-09-09
9
401 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
 
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

919 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now