Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8562117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:39:39+00:00 2026-06-11T16:39:39+00:00

Possible Duplicate: Is there any way to force the WorkingSet of a process to

  • 0

Possible Duplicate:
Is there any way to force the WorkingSet of a process to be 1GB in C++?

We would like to increase the WorkingSet of a .NET process to 1GB, in advance, to avoid page faults.

Is there a way to do this in .NET?

Update

Unfortunately, it appears that even if we do a call to SetProcessWorkingSetSizeEx, the garbage collection trims the working set down anyway, bypassing MinWorkingSet (see “Automatic GC.Collect() in the diagram below).

In the picture below, is there a way to lock the process WorkingSet (the green line) to 1GB, to avoid the spike in page faults (the red lines) that occur when allocating new memory into the process?

The reason this would be awesome is that every time a page fault occurs, it blocks the thread for 250us, which hits application performance badly.

enter image description here

Update

Quote from: “Windows via C/C++, Fifth Edition, Jeffrey Richter (Wintellect)”

Calls to SetProcessWorkingSetSize by an individual process are ignored
unless the process is just trying to empty its working set. To set
this limit, specify the JOB_OBJECT_LIMIT_WORKINGSET flag in the
LimitFlags member.

This book is implying that the only way to set the WorkingSet is by assigning the process to a Job Object and setting JOB_OBJECT_LIMIT_WORKINGSET and MinimumWorkingSetSize.

Update

SetProcessWorkingSetSizeEx has absolutely nothing to do with soft page faults. It only refers to hard page faults, as it prevents memory in the current WorkingSet being paged out to the hard drive.

Update

It turns out that the only method to increase the WorkingSet is to run .NET using an extremely specialized CLR Host written in C++ (see my answer below).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T16:39:40+00:00Added an answer on June 11, 2026 at 4:39 pm

    The only way that we could find to increase the WorkingSet of a process under .NET, to reduce soft page faults, was to run the entire .NET application under a custom CLR Host. This is a non-trivial exercise, requiring about 800 lines of custom written, rather dense C++ code. The C++ code intercepts the .NET calls to the Win32 memory management methods, altering the behavior of the .NET runtime so it doesn’t free memory as aggressively as it normally would.

    This has the effect of incurring all of the soft page faults when the application starts up, so that during normal application execution, the number of soft page faults in the .NET app drops pretty much to zero.

    This means that the application may be memory hungry, but it runs faster. In other words, we are sacrificing memory usage for increased realtime performance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Is there any way to determine text direction from CultureInfo in asp.net?
Possible Duplicate: Porting VB.NET Winforms Application to C# Is there any way to convert
Possible Duplicate: Any way to add HttpHandler programatically in .NET? Is there a way
Possible Duplicate: Is there any way to detect strings like putjbtghguhjjjanika? php check if
Possible Duplicate: Any way to “reboot” the JVM? Is there any option to restart
Possible Duplicate: Objective C for Windows iPhone development on Windows Is there any way
Possible Duplicate: Overriding the power button in Android Is there any possible way I
Possible Duplicate: Select xml node by attribute in php Is there any function like
Possible Duplicate: Is there any way in C# to override a class method with
Possible Duplicate: Is there any way to know if the value of an argument

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.