1

I am running some extremely memory intensive calculations that can balloon to use a great deal of memory for a process (a java program). I have increased the maximum java heap size to 64 GB to allow for this. Java memory usage gets to approximately 66 GB, and then my system comes to a halt and I begin to get "out of application memory" errors.

Similarly, when one of my python processes expands to beyond 96 GB of memory usage, it is forcibly killed by the OS.

I have 16 GB of physical ram and >1.5TB of free SSD space for swap; why would I be running out of memory? Why doesn't swap expand further? I am running Monterey 12.3.1 on an M1 system.

Here are the first 20 lines of my activity monitor Memory tab

Process Name                   Memory    Threads Ports
Icy (Not Responding)           66.68 GB  61      431
Firefox                        957.9 MB  82      3,916
WindowServer                   802.4 MB  22      2,270
FirefoxCP WebExtensions        340.2 MB  30      473
Dropbox                        286.7 MB  137     866
syncthing                      190.2 MB  19      94
FirefoxCP Isolated Web Content 162.4 MB  30      161
FirefoxCP Isolated Web Content 124.6 MB  30      171
Quicksilver                    122.3 MB  11      444
Preview                        108.9 MB  3       267
Activity Monitor               108.1 MB  7       651
TextEdit                       102.6 MB  3       288
FirefoxCP Isolated Web Content 99.7 MB   30      172
Finder                         97.2 MB   6       590
loginwindow                    95.8 MB   4       484
1Password 7                    92.3 MB   5       601
mds                            67.6 MB   8       300
Dropbox Helper (GPU)           58.2 MB   8       163
FirefoxCP Privileged Content   55.4 MB   30      200

And here is the output from vm_stat:

Mach Virtual Memory Statistics: (page size of 16384 bytes)
Pages free:                                4581.
Pages active:                            173948.
Pages inactive:                          168906.
Pages speculative:                         5133.
Pages throttled:                              0.
Pages wired down:                        119918.
Pages purgeable:                             89.
"Translation faults":                 726424696.
Pages copy-on-write:                    2352123.
Pages zero filled:                     75215138.
Pages reactivated:                    119697667.
Pages purged:                           1363563.
File-backed pages:                        40710.
Anonymous pages:                         307277.
Pages stored in compressor:             4404306.
Pages occupied by compressor:            527236.
Decompressions:                       553185303.
Compressions:                         578504830.
Pageins:                                4814101.
Pageouts:                                135825.
Swapins:                              302428830.
Swapouts:                             314732554.
7
  • What is the size of your swap when you start running out of RAM? Best to show us screenshot of Activity Monitor showing biggest memory apps and current memory use. Terminal output from command vm_stat might be useful.
    – Gilby
    Commented Apr 30, 2022 at 0:01
  • @Gilby added data to question Commented May 1, 2022 at 14:25
  • A screenshot of the Memory summary at the bottom of Activity Monitor would be useful.
    – benwiggy
    Commented May 1, 2022 at 14:40
  • 2
    OT but on Java usage - Java is slow if the process gets swapped out as it looks at all memory in its garbage collection - We ran Java apps with no OS swap. In this case I would look at another algorithm or implementation that explicitly manages memory using files etc and not rely on the OS.
    – mmmmmm
    Commented May 1, 2022 at 15:04
  • Looking at stats: Wired memory 2GB, compressed 8.5GB much as expected. Active 2.8GB also much as expected - but that is all you have for running applications! And a vast amount of swapouts/ins - 5TB (though we don't know when you last booted). Even if java app were to run, unlikely to finish in an acceptable timeframe. Your Mac just doesn't cut it if you can't get a less memory intensive app or algorithm. You would be better with an Intel iMac (128GB) or Studio Ultra (128GB) or MacPro.
    – Gilby
    Commented May 1, 2022 at 23:39

1 Answer 1

0

Short answer: OS X kills any process that makes the swap file grow beyond a certain hardcoded size. As of 2021, that size was 100 GB. The actual amount of memory where the process gets killed will vary based on other running processes and how compressible the data is, since the swap file is compressed.

Answered elsewhere https://apple.stackexchange.com/a/458629/199014

1
  • 1
    If this answered elsewhere then this question should be flagged as a duplicate and pointed to the answers elsewhere. Thus information does not need to be copied into this question.
    – mmmmmm
    Commented Nov 29, 2023 at 17:46

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