My ubuntu 18.04 64bit isn't using the swap file/partition to the point when the 8gigs(of which 7.3 are usable) of ram almost fills up, and when it does, and actually writes some things in swap it freezes/becomes unresponsive after a couple of hundreds of MB, usually when 750MB+ is written into swap.
I have googled similar problems and so far tried a few different things but nothing works.
This happened on another Ubuntu install on the same machine that had a 2GB swap partition created by the installer automagically, it happened on the current Ubuntu install where I allocated 15G of space for a proper swap partition, and again when I created a 5G swap file.
I also tried increasing swappiness from the default 60 to 80, but still, Ubuntu doesn't use the swap until I reach the 6-7G mark of used ram, and then if I'm lucky I can navigate with alt-tab and restart the computer, sometimes if it's really bad the mouse stops responding, other times the mouse clicks do absolutely nothing inside open windows(it does close the windows occasionally, and can navigate through web pages using the keyboard), waiting for minutes usually is futile, and if it freezes completely I can only restart using REISUB.
Edit: i will try the suggestions in the comments. I already tried decreasing the swappiness to 15 as suggested, And I haven't experienced freezes since, although I was only able to fill the ram twice since(probably somethings leaks memory in the long run) - it wasn't much in the swap only 35-175MB.