Score:0

Memory intensive process getting killed before swap memory is full

km flag

I have a very memory intensive Java program to run, at first it was giving heap out of memory error so I kept in increasing the heap size along with the swap partition (I only have 32 GBs of RAM and I went way past that). When I had around 300 GBs for the heap size, the program used to run until I use around 170 GBs then seemingly get killed (the terminal would just close with no error meesages or crash messages shown, the same goes for running from the IDE it is like I killed it from the terminal but I did not). After multiple tries it managed to run till the swap memory is full then it stopped executing and the IDE displayed a kill signal related to being out of memory (totally normal, it did not suddenly close the IDE with no message). I increased the swap size to 700 GBs and tried two runs which also resulted in the terminal and IDE getting killed, the swap memory was not even half full. I am running Ubuntu 22.04 LTS, the CPU usage is low (less than 50% on a single core and others idle), and I am not using the PC for any other tasks during the run. Run times are less than 10 minutes. Any help on how to fix that would be appreciated.

Update:

There does not seem any memory usage or time threshold where the process gets killed everytime it seems random.

Running sudo dmesg -w along with the command did not show anything when the process got killed. Similarly, checking the kernel logs at /var/log/kern.log* did not show anything relating to what is happening. Running top with the process running did not show a spike in the wa value when the kill happened. Max I could reach before the process got killed was around half an hour of running time with 500 GBs of the swap memory used, the run immediately before that crashed in few minutes when the swap used was 100 GBs.

Hugo avatar
mx flag
It might be worth watching the syslog to see if anything is printed when the application closes. Run `sudo dmesg -w` in another terminal while you run your application.
in flag
Large swap files come with their own limitations. If the `io_wait` for a process gets too high, which will happen if the storage device is write or read constrained, then a process can be killed to prevent the entire machine from locking up. This is particularly bad on systems where the storage devices share the data bus with other hardware
Sergio avatar
km flag
@Baa this did not show anything unfortunately
Sergio avatar
km flag
@matigo this does not seem the case after running the process along with the `top` command in another terminal
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.