Just switched 4GBs to 16GBs of RAM. However, when I look at how much memory I have, it says 15.3. I'm just wondering why did my memory drop down when I just installed 16 GBs of RAM.
-
Possible duplicate of [Why will Ubuntu no longer measure file size unit as byte, megabyte, gigabyte, etc?](http://askubuntu.com/questions/465/why-will-ubuntu-no-longer-measure-file-size-unit-as-byte-megabyte-gigabyte-et) – dadexix86 Mar 08 '16 at 23:04
-
2This is not a duplicate of that question. RAM size is reported in base 2 by both manufacturers and Ubuntu. The difference is due to something else. – TheSchwa Mar 08 '16 at 23:57
-
The other forum does not answer my question as to why I went from 16GB to 15.3. It's not about the changes of the file, I just want to know what happened to the rest of my memory? Is it something that Linux does. Take up a portion, or something in that matter. – Geri Sati Mar 09 '16 at 00:09
-
That screen show 15.6 for me. But free in terminal shows 16308044 . Is video excluded in one and not other? – oldfred Mar 09 '16 at 00:32
-
If you claim that all sizes are on base 2, please use a consistent notation. See `man units` for a convenient reference. To add to the confusion, also note in your screenshot that GiB is used for memory, and GB for disk space – XavierStuvw Jun 08 '17 at 17:57
1 Answers
Short Answer
It's probably just the kernel using memory. Instead of reporting kernel memory usage, Ubuntu instead subtracts form the total available. This is simply to let you know that the kernel memory cannot be freed in most cases. That memory is being used for things that are absolutely necessary, and so it will never be available.
Diagnostic Commands
I don't expect you to run all of these, but I've included them here for reference and completeness. Most relevant are commands 3 and 4. Also please note that all sizes are going to be in base 2 (e.g. GiB) and not in base 10 (e.g. GB) despite what the unit abbreviations might be.
You can check how big your RAM sticks are claiming to be with:
sudo dmidecode | grep Size | grep MBYou can check how much RAM is available for general use with (look for
Memandtotal):free -hYou can estimate how much memory the kernel is using with:
cat /proc/meminfo | grep SlabYou can check for "stolen" graphics card memory with:
dmesg | grep stolenYou can look for specific hardware reserved memory by looking through:
dmesg | grep e820You can test to make certain all of your memory works by running memtest
Explanation
The most likely explanation is simply that the extra space is being used by either your graphics card or the kernel itself. If you're not familiar, the kernel is the lowest-level part of the operating system, and any memory that it's using will not be available to you and so is not reported as free. The memory might be used for any number of reasons, such as the virtual memory tables, memory-mapped I/O, kernel processes, certain caches, shared graphics memory, etc.
Example: Looking at My Laptop
It is very likely that adding the output of command 3 to your 15.3GiB will result in almost exactly 16GiB. This was the case in my system:
- Installed RAM:
6GiB - Reported in System Settings > Details:
5.6GiB - Output of
cat /proc/meminfo | grep Slab:316652 kB - Converted to
GiB:316652/2^20 = 0.3GiB - Output of
dmesg | grep stolen:32768K - Converted to
GiB:32768/2^20 = 0.03GiB - Adding them together:
5.6 + 0.3 + 0.03 = 5.93GiB
Since the Slab memory is not comprehensive, we can assume that the kernel is using the remaining 0.07GiB in places we can't see, and so this is a very satisfying result.
See Also
-
2Kernel slab memory is counted as part of "used memory" and does not reduce the "total" memory. You can see that quite easily by checking the system when it has a lot of slab in use, and again when it is little. – psusi Jun 08 '17 at 13:40
-
1`cat | grep` is a useless use of `cat`: `grep` itself accepts filenames as parameters. – Ruslan Jun 08 '17 at 16:44
-
@Ruslan Lol, thanks. I still haven't trained myself out of that one. Albeit it's less "correct" in some sense, I still like it for readability and it flows better with the other commands in the post. – TheSchwa Jun 08 '17 at 19:00
-
I disagree that it is useless. With command-line ctrl keys, it can be faster to issue a series of grep commands with the `cat xxx | grep yyy` approach. And often the only thing changing is the grep pattern from file to file and it ends up being faster overall – Troy Folger Mar 25 '23 at 06:02
