0

We are having problems with soft page faults interrupting our application.

As a soft page fault can be caused by the act of increasing the working set for a program, is there a method to increase the working set of the program, on startup, in advance?

Update:

There is a couple of excellent answers at How to set MinWorkingSet and MaxWorkingSet in a 64-bit .NET process?.

Update:

This question is also being discussed at Is there a way to expand the current WorkingSet of a process to 1GB?

Community
  • 1
  • 1
Contango
  • 76,540
  • 58
  • 260
  • 305
  • Have you done the requisite profiling and optimization of your code first? Throwing more hardware at your program is one solution, but it might not be the cheapest in the long run. – Mike Atlas Aug 30 '12 at 19:03
  • Yes, three weeks of intensive profiling and optimizing of code. We have tracked the source of our latency issues down to page faults happening at the most inopportune times in our application. – Contango Aug 30 '12 at 19:21
  • 2
    Would you show some more hard numbers of the profiling you're seeing? Right now, there's not enough information to effectively help you. – casperOne Aug 30 '12 at 19:48

1 Answers1

3

You can set the working set size using Process.CurrentProcess().MinWorkingSet.

The documentation says that doing this doesn't guarantee that the memory will be reserved or resident. See http://msdn.microsoft.com/en-us/library/windows/desktop/ms686234(v=vs.85).aspx for more information.

Jim Mischel
  • 131,090
  • 20
  • 188
  • 351
  • For details of how to set the working set in a 64-bit process, see http://stackoverflow.com/questions/12203969/how-to-set-minworkingset-and-maxworkingset-in-a-64-bit-net-process. – Contango Aug 31 '12 at 15:01