1

I am writing an application which searches for solutions to simple problems and I am testing various algorithms. I would like the system to throw an out of memory exception before paging to disk, and to run my software at various levels of memory availability. Is this possible?

I figured the AppDomain was the best place to look, but I was only able to find total memory allocated since app domain was created. I did find this related question, but I do not care about CPU at all and just want to focus on disallowing paging for my app.

Community
  • 1
  • 1
Nick Larsen
  • 18,631
  • 6
  • 67
  • 96
  • 2
    maybe maybe [this question](http://stackoverflow.com/questions/4852062/limiting-process-memory-with-maxworkingset) be useful, take a look at it – void Jan 28 '15 at 21:32

1 Answers1

1

You can limit various metrics such as memory and CPU usage per process. This can be done using Windows Job Objects. This is a kernel facility. You'll have to use unsafe code to access it.

usr
  • 168,620
  • 35
  • 240
  • 369