I did
ulimit --help
this was part of the info
-l the maximum size a process may lock into memory
so it looks like it is reporting a limit to a process not your actual ram.
I know. I was just exaggerating, and I looked up the docs to see how to change things - which I have. Now, I’ll just see if it makes a difference - which I know it may not. Will eventually update the post again with my findings.
does not show you how much of your RAM is available, that’s a misunderstanding. It also does not show you how much memory can a process use. What it does show you is how much memory can be locked into RAM, typically using the mlock() syscall, per process for your user.
A process can lock part of its virtual address space into RAM using the aforementioned syscall, and this is the limit. Most of the time, it does not do that, because there is no need to, and there is a performance penalty for unnecessarily locking and unlocking pages. Besides, locking too many pages can decrease the efficiency of swap. So in practice, most of the virtual address space that a program uses remains unlocked.
Locking pages into RAM simply means that the kernel guarantees that those pages will remain in RAM, and will never1 be swapped to the drive, until they are unlocked. Why is this useful? Only in very specific cases. For example, assume you have a cryptographic algorithm running in some process, encrypting or decrypying some data. What you absolutely do not want is the kernel deciding to swap the memory containing secret information to the disk, where it can be reconstructed by some malicious third party. You want that data to remain in RAM at all times, so the program first tells the kernel not to swap those pages – it locks those pages into RAM – and only then it writes sensitive data to them. Also, if some algorithm depends on deterministic timing, the kernel deciding to start swapping in the middle of the algorithm will create a non-deterministic delay and produce wrong results. Again, the solution is locking those pages in RAM.
1 There is one exception that I am aware of (and I’m not a security expert, so there might be others), and that is hybernation, which can be a security risk. A program that writes sensitive data into locked pages also ought to temporarily disable hibernation, otherwise those pages can get written to disk, despite being locked.