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.