How to limit visible amount of physical RAM to an application?

Nicholas Steel 336 Reputation points
2021-09-15T17:05:12.25+00:00

Is there a way to limit how much physical RAM a specific program will be able to utilize? Like limit how much it can see as available without impacting the ability to use Swap/Paging File and without impacting how much RAM other software can see & use.

For software running in Windows.

Anno 1800 likes to use around 24GB's of memory and will aggressively use all available physical RAM, resulting in any newly created task or operation that triggers an increase in RAM consumption, to page data in and out of RAM which is sloooow and manifests as system wide stutter and lag.

I'd like to limit the game to seeing only 15~GB's of my 16GB's of RAM and leave 1GB free for background tasks and multi-tasking (like how modern video game consoles have a portion of RAM dedicated to the O/S and background tasks).

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
11,113 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Laude 85,716 Reputation points
    2021-09-15T17:15:20.507+00:00

    Hi @Nicholas Steel ,

    As far as I know there is no Microsoft solution for this, you will have to find third-party software that may be able to do this.

    Here's also a similar thread which may be of interest to you:
    Is it possible to limit the memory usage of a particular process on Windows

    ----------

    If the reply was helpful please don't forget to upvote and/or accept as answer, thank you!

    Best regards,
    Leon

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Limitless Technology 39,506 Reputation points
    2021-09-16T08:59:03.827+00:00

    Hello,

    You could use something like Windows System Resource Manager which has similar features to ulimit (ulimit -v, it's a shell and it should do what you want((ulimit -v 400; myprogram) to limit the scope)) in that you can set CPU or memory limits on a process, user or session.

    More information is available on Technet(2008 R2 specific) or here is the Wiki article.

    https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/cc732553(v=ws.11)?redirectedfrom=MSDN

    https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/cc755056(v=ws.11)?redirectedfrom=MSDN

    Windows system resource manager is the tool to set cpu limits per process, and adds process accounting interfaces. In 2008 its a feature to be enabled. There is an API that lets you set disk IO priority explicitly but I am unaware of any utility to let you directly change just disk priority.

    I hope this will help you!
    Regards,