Search code examples
maple

Stop execution when RAM is filled (i.e. avoid writing to Disk)


I have this problem:

  1. I run some large calculations before going to sleep (or work).
  2. When I return sometimes RAM is already filled and the program starts writing to Disk, which is a problem since then computer becomes almost non responsive, also the button "Interrupt the current operation" doesn't stop mserver.exe from executing a task. This is what I saw 10 mins after I pressed the button "Interrupt the current operation":enter image description here
  3. Not to mention that calculations are probably like 100 or even 1000 times slower when it starts using Disk instead of RAM (so it's pointless anyway).
  4. Another problem is that I was unable to save some variables to file since in Maple I couldn't type anything while mserver.exe was executing a task and after I killed the process mserver.exe I was still unable to save those variables since Maple commands don't work when connection to kernel is lost.

So, my question: can I make it so that mserver.exe won't use Disk at all (I mean from Maple alone, not by disabling page file in Windows) and just stop execution automatically when RAM is full (just like Classic Maple does when it hits 2GB limit)?

Also it would be nice to be able to limit Maple from using processor too much, for example up to 75% or so, so that I could work on that computer without problems.


Solution

  • You might experiment with a few of the options available for specifying limits on the Maple (kernel, mserver) engine.

    In particular,

    --init-reserve-mem=memorysize
    

    (or, possible, the -T option). See here for some more detail: https://www.maplesoft.com/support/help/MapleSim/view.aspx?path=maple

    On Linux/OSX you could pass that in a call to the maple script that launches Maple. On MS-Windows you could add that to the command string/Property in the launcher (icon).

    You might try setting it to a fraction of your total RAM, eg. 50-75%, and see how it goes. Presumably you'll have some other processes running.

    As far as restricting the CPU use goes, that's more of a OS issue. On Linux/OSX you could use the system's nice facility. I don't know what's avaliable on MS-Windows (built-in or 3rd party). You might be able to set the Priority of the running mserver process from the Task Manager. Or you might look at something like the START facility:

    https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/start