I saw dos2unix mentioning a few useful things I already know but he forgot to mention one very annoying function in the linux kernel that is supposed to be a benefit but in fact it does the opposite - unloading free RAM. For instance, you've played a game that uses 16 GiB RAM, your distro normally uses 4 GiB and that's 20 GiB RAM. But when you close the game, the used RAM remains at 20 GiB. Why? Because of a function called "huge pages". This appeared somewhere in the kernel 6.x versions and its main purpose remains a mystery to me bc it creates more problems than it fixes.
But there's a very easy fix for that:
1. Open grub.cfg with your favorite text editor:
2. Find the 'linux' line. The easiest way for that is to use CTRL+F and paste this in the search field:
Assuming you haven't added anything, it will look something like this:
3. AFTER the rw characters add space and then paste this:
and then reboot.
Note: when you edit grub.cfg directly, you DON'T need to run the grub update command. System reboot is enough.
Once the hugepages function is disabled, you'll notice that when you close a game or a program, the free amount of RAM changes almost instantly, giving you a more precise information and control over what actually is using your memory.
But there's a very easy fix for that:
1. Open grub.cfg with your favorite text editor:
Code:
sudo pluma /boot/grub/grub.cfg
2. Find the 'linux' line. The easiest way for that is to use CTRL+F and paste this in the search field:
Code:
linux /boot/vmlinuz-linux
Assuming you haven't added anything, it will look something like this:
Code:
linux /boot/vmlinuz-linux root=UUID=1a2db951-3fc5-4880-9e2a-be94175245eb rw
3. AFTER the rw characters add space and then paste this:
Code:
transparent_hugepage=never
Note: when you edit grub.cfg directly, you DON'T need to run the grub update command. System reboot is enough.
Once the hugepages function is disabled, you'll notice that when you close a game or a program, the free amount of RAM changes almost instantly, giving you a more precise information and control over what actually is using your memory.

