33

A user is doing calculations in Excel on very large sheets (upwards of 500mb) even with 16GB of ram, Excel (64-bit) will eat up all existing memory,I have seen it use upwards of 11GB of system memory.

Is there a way to say limit it somewhere reasonable at like 8GB so the system isn't bogged down and swapping through the pagefile to open a new tab in Chrome?

7
  • 1
    If you limited it, as soon as it hit that limit, it would bog down and swap through the pagefile. Oct 27, 2017 at 17:51
  • I'm ok with Excel bogging down, it's the rest of the computer and other applications having no avilable memory that is the issue.
    – screampuff
    Oct 27, 2017 at 17:52
  • 2
    Swapping will bog down the whole system. Everything competes for the available I/O bandwidth. Everything competes for access to the kernel subsystem that transitions memory between free and in use. And so on. If you could memory constrain one process, you would make the whole system slow. You're almost certainly better off getting the calculations done quickly and efficiently. Oct 27, 2017 at 18:18
  • 1
    Unsure what the sheets are for, but it might be that Excel is the wrong tool: maybe a database would be a better choice.
    – Yorik
    Oct 27, 2017 at 18:43
  • 4
    system job object? - lowleveldesign.org/2013/11/21/… might allow you to see the behaviour and if it's worth while. Oct 27, 2017 at 20:15

4 Answers 4

19

I understand here the question is to find a way to limit the memory used by a process, no matter the impact of performance.

On Windows Server, you could do this using a tool called the Windows System Resource Manager which can limit the amount of working set that a process uses. This tool is installable (not installed by default) through the Add Features console on Windows Server 2008 R2.

On Windows 7/8/10 there is no Microsoft solution able to do this. You have to install a third party software like the following :

2
  • 4
    In their web page they say it modifies CPU usage. How can memory-usage be managed in them? Apr 27, 2021 at 4:56
  • To control quotas for memory and/or CPU usage, see @Mikhail’s answer discussing the free Processor Governor tool. (My 2022 answer also has a few additional details, fwiw.) Aug 28, 2022 at 19:41
17

Process Governor worked great for me. Open source, MIT License, easy to use:

procgov --maxmem 40M your_app.exe
3
1

As mentioned in @Mikhail’s answer, one can now easily utilize the Windows built-in system ‘Job Object’ using the free Processor Governor tool to set per-launch or persistent (via a registry entry) limits on CPU usage/allocation/affinity, memory usage, and network usage.

  • Using that tool as documentation, I suspect manual registry entries might make this possible without installing any third-party software.
  • Note for Process Governor: use the --recursive option with programs such as web browsers (and the apps based on them, such as ‘Electron’ apps) to make sure all of their (often numerous) child processes fall within the desired quotas.

Other possible options, as of 2022:

  1. Not sure if there is an operational method to do this, but there is a GPO security setting for users controlling process memory limits.

  2. Running the 32-bit version of Excel should intrinsically limit the amount of memory it can use to 2GB (or 3GB/4GB, depending on Windows version and settings) of RAM.

    • (Sadly, this won’t work for web browsers such as Google Chrome or Microsoft Edge that use a different process for ~every~ tab.)
  3. Run Excel within a VM (e.g. Hyper-V) or a container (e.g. native Windows or via Kubernetes) that has a built-in method for limiting CPU and RAM usage.


Older questions with possible leads or solutions:

-3

If the problem is that you're having trouble doing other things on the computer at the same time, you might want to try reducing Excel's CPU priority. So if you run something else, Excel will be forced to stop and wait since your program has a higher priority. It will take longer to finish, but you should be able to do other things at the same time.

Instructions for Windows 7:

  1. Open the Task Manager (Ctrl+Alt+Del)
  2. Open the Processes tab. Right-click on excel.exe and go to Set Priority.
  3. Choose a new priority. Most processes run at Normal, so you can use either Below Normal or Low.

This is temporary, so you'll have to do it again if you quit Excel.

Source: https://www.sevenforums.com/tutorials/83361-priority-level-set-applications-processes.html

2
  • What does “using memory that isn't being used by anything else” mean?  I believe that your answer would still allow Excel to gobble up all the memory, but it would cause it to hold onto it for a longer period of (real) time.  Do you have a reason to believe otherwise? Please do not respond in comments; edit your answer to make it clearer and more complete. Mar 6, 2018 at 20:59
  • 1
    Edit made. I think some RAM might get reallocated by Superfetch but the point is to make other programs run faster. I might have the wrong idea though. Mar 7, 2018 at 2:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .