I'm running a complex Matlab program on my Ubuntu computer. It needs to load several .MAT files, each of which is several GB on disk and larger in RAM. I know it is possible to run this program - a coworker of mine who has a MacBook with 32 GB of RAM almost never sees it crash - but my tower, with 128 GB of RAM and Ubuntu 22.04, has not yet successfully run it all the way through, always crashing for lack of memory.
I am not worried about other programs hoarding significant amounts of memory. The memory is totally going to Matlab as it loads the data and as it processes the data.
One obvious measure is to increase the size of the swap file; I increased it from 2 GB to 32 GB. However, that seems not enough. I was perplexed to see the RAM fill up to 99.6% and hover around there while the swap space remained oblivious, staying at about 26% full and not changing much for a minute until the program finally crashed.
It might be that I decreased the swappiness too much - I saw recommendations of decreasing it from the default 60 to a much lower value, so I put it at 5. I've since increased the swappiness to 15, but maybe I should put it higher still? Alongside swappiness I also saw mentions of cache pressure, but I think I want to keep the cache pressure as high as possible, so the default of 100 seems good.
Anything else I'm missing?