Zsh kills Python process with plenty of available VM
On a MacBook Pro, 16GB of RAM, 500 GB SSD, OS Sequoia 15.7.1, M3 chip, I am running some python3 code that requires lots of RAM and sure enough, once physical memory is exhausted, swapfiles of about 1GB each start being created, which I can see in /System/Volumes/VM. This folder has about 470 GB of available space at the start of the process (I can see this through get info) however, once about 40 or so swapfiles are created, for a total of about 40GB of virtual memory occupied (and thus still plenty of available space in VM), zsh kills the python process responsible for the RAM usage (notably, it does not kill another python process using only about 100 MB of RAM). What's going on here? All the documentation I was able to consult says macOS is designed to use all available storage on the startup disk (which must be the one I am using since I have only one disk and the available space aforementioned reflects this).
Then why zsh kills the process with so much available VM? Also, I changed the shell from zsh to bash, not sure whether this makes a difference (though it is still zsh that kills the process, not bash). One last note, I do not have administrator rights on this device, so I could not run dmesg to retrieve more precise information, but I doubt my employer put a cap on RAM usage on my profile, since this should not be possible on macOS and even if it were, I suppose it would show when I get info when I check the available space in VM.
Thanks for any insight you can share on this issue, is it a known bug or something? I could not find anything recent on it.
MacBook Pro 13″