Sum of cached memory and shared memory exceed total memory [duplicate]

Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
This question already has an answer here:
`free`: output format
2 answers
When I run free -h, I get:
total used free shared buffers cached
Mem: 251G 208G 43G 179G 144M 190G
-/+ buffers/cache: 17G 233G
Swap: 5.6G 5.6G 1.1M
How can shared memory(179G) + cached memory(190G) exceed total memory (251G) ? Can memory be count as both of cached memory and shared memory?
linux memory
marked as duplicate by Romeo Ninov, schily, Jesse_b, RalfFriedl, G-Man Nov 30 at 3:02
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
up vote
2
down vote
favorite
This question already has an answer here:
`free`: output format
2 answers
When I run free -h, I get:
total used free shared buffers cached
Mem: 251G 208G 43G 179G 144M 190G
-/+ buffers/cache: 17G 233G
Swap: 5.6G 5.6G 1.1M
How can shared memory(179G) + cached memory(190G) exceed total memory (251G) ? Can memory be count as both of cached memory and shared memory?
linux memory
marked as duplicate by Romeo Ninov, schily, Jesse_b, RalfFriedl, G-Man Nov 30 at 3:02
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
1
Welcome to U&L! Yes, apparently it can. See, for example, this explanation from Red Hat. See the line: "Cached: Memory in the pagecache (Diskcache and Shared Memory)"
– fra-san
Nov 29 at 12:47
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
This question already has an answer here:
`free`: output format
2 answers
When I run free -h, I get:
total used free shared buffers cached
Mem: 251G 208G 43G 179G 144M 190G
-/+ buffers/cache: 17G 233G
Swap: 5.6G 5.6G 1.1M
How can shared memory(179G) + cached memory(190G) exceed total memory (251G) ? Can memory be count as both of cached memory and shared memory?
linux memory
This question already has an answer here:
`free`: output format
2 answers
When I run free -h, I get:
total used free shared buffers cached
Mem: 251G 208G 43G 179G 144M 190G
-/+ buffers/cache: 17G 233G
Swap: 5.6G 5.6G 1.1M
How can shared memory(179G) + cached memory(190G) exceed total memory (251G) ? Can memory be count as both of cached memory and shared memory?
This question already has an answer here:
`free`: output format
2 answers
linux memory
linux memory
asked Nov 29 at 12:28
Hansol Shin
162
162
marked as duplicate by Romeo Ninov, schily, Jesse_b, RalfFriedl, G-Man Nov 30 at 3:02
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Romeo Ninov, schily, Jesse_b, RalfFriedl, G-Man Nov 30 at 3:02
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
1
Welcome to U&L! Yes, apparently it can. See, for example, this explanation from Red Hat. See the line: "Cached: Memory in the pagecache (Diskcache and Shared Memory)"
– fra-san
Nov 29 at 12:47
add a comment |
1
Welcome to U&L! Yes, apparently it can. See, for example, this explanation from Red Hat. See the line: "Cached: Memory in the pagecache (Diskcache and Shared Memory)"
– fra-san
Nov 29 at 12:47
1
1
Welcome to U&L! Yes, apparently it can. See, for example, this explanation from Red Hat. See the line: "Cached: Memory in the pagecache (Diskcache and Shared Memory)"
– fra-san
Nov 29 at 12:47
Welcome to U&L! Yes, apparently it can. See, for example, this explanation from Red Hat. See the line: "Cached: Memory in the pagecache (Diskcache and Shared Memory)"
– fra-san
Nov 29 at 12:47
add a comment |
1 Answer
1
active
oldest
votes
up vote
3
down vote
All shared memory is also counted as cached.
shared memory is implemented using tmpfs internally. tmpfs is implemented as a thin wrapper for the page cache, just without having any backing store (except that tmpfs is swappable).
man free does not explain this. At least on my system (provided by procps-ng, last updated 2016-06-03). Sorry. All man free tells you is that cache is taken from Cached in /proc/meminfo. If you read man proc (from man-pages, updated 2017-09-15), it has documentation for the fields in the meminfo file, but it still fails to inform you that Cached includes Shmem.
You can see this with an experiment. While you have free memory (not available), you can create a file in a tmpfs, for example:
dd bs=1M count=100 < /dev/zero > /dev/shm/test.tmp
The result of this is that both the shared and cached figures in free -m increase by 100.
If you only have available memory, and do not have enough free memory to test this properly, you can create free memory by dropping as much page cache as possible, by running echo 1 | sudo tee /proc/sys/vm/drop_caches. Of course dropping page cache can be very bad for performance. Do not do this on a real server :-).
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
All shared memory is also counted as cached.
shared memory is implemented using tmpfs internally. tmpfs is implemented as a thin wrapper for the page cache, just without having any backing store (except that tmpfs is swappable).
man free does not explain this. At least on my system (provided by procps-ng, last updated 2016-06-03). Sorry. All man free tells you is that cache is taken from Cached in /proc/meminfo. If you read man proc (from man-pages, updated 2017-09-15), it has documentation for the fields in the meminfo file, but it still fails to inform you that Cached includes Shmem.
You can see this with an experiment. While you have free memory (not available), you can create a file in a tmpfs, for example:
dd bs=1M count=100 < /dev/zero > /dev/shm/test.tmp
The result of this is that both the shared and cached figures in free -m increase by 100.
If you only have available memory, and do not have enough free memory to test this properly, you can create free memory by dropping as much page cache as possible, by running echo 1 | sudo tee /proc/sys/vm/drop_caches. Of course dropping page cache can be very bad for performance. Do not do this on a real server :-).
add a comment |
up vote
3
down vote
All shared memory is also counted as cached.
shared memory is implemented using tmpfs internally. tmpfs is implemented as a thin wrapper for the page cache, just without having any backing store (except that tmpfs is swappable).
man free does not explain this. At least on my system (provided by procps-ng, last updated 2016-06-03). Sorry. All man free tells you is that cache is taken from Cached in /proc/meminfo. If you read man proc (from man-pages, updated 2017-09-15), it has documentation for the fields in the meminfo file, but it still fails to inform you that Cached includes Shmem.
You can see this with an experiment. While you have free memory (not available), you can create a file in a tmpfs, for example:
dd bs=1M count=100 < /dev/zero > /dev/shm/test.tmp
The result of this is that both the shared and cached figures in free -m increase by 100.
If you only have available memory, and do not have enough free memory to test this properly, you can create free memory by dropping as much page cache as possible, by running echo 1 | sudo tee /proc/sys/vm/drop_caches. Of course dropping page cache can be very bad for performance. Do not do this on a real server :-).
add a comment |
up vote
3
down vote
up vote
3
down vote
All shared memory is also counted as cached.
shared memory is implemented using tmpfs internally. tmpfs is implemented as a thin wrapper for the page cache, just without having any backing store (except that tmpfs is swappable).
man free does not explain this. At least on my system (provided by procps-ng, last updated 2016-06-03). Sorry. All man free tells you is that cache is taken from Cached in /proc/meminfo. If you read man proc (from man-pages, updated 2017-09-15), it has documentation for the fields in the meminfo file, but it still fails to inform you that Cached includes Shmem.
You can see this with an experiment. While you have free memory (not available), you can create a file in a tmpfs, for example:
dd bs=1M count=100 < /dev/zero > /dev/shm/test.tmp
The result of this is that both the shared and cached figures in free -m increase by 100.
If you only have available memory, and do not have enough free memory to test this properly, you can create free memory by dropping as much page cache as possible, by running echo 1 | sudo tee /proc/sys/vm/drop_caches. Of course dropping page cache can be very bad for performance. Do not do this on a real server :-).
All shared memory is also counted as cached.
shared memory is implemented using tmpfs internally. tmpfs is implemented as a thin wrapper for the page cache, just without having any backing store (except that tmpfs is swappable).
man free does not explain this. At least on my system (provided by procps-ng, last updated 2016-06-03). Sorry. All man free tells you is that cache is taken from Cached in /proc/meminfo. If you read man proc (from man-pages, updated 2017-09-15), it has documentation for the fields in the meminfo file, but it still fails to inform you that Cached includes Shmem.
You can see this with an experiment. While you have free memory (not available), you can create a file in a tmpfs, for example:
dd bs=1M count=100 < /dev/zero > /dev/shm/test.tmp
The result of this is that both the shared and cached figures in free -m increase by 100.
If you only have available memory, and do not have enough free memory to test this properly, you can create free memory by dropping as much page cache as possible, by running echo 1 | sudo tee /proc/sys/vm/drop_caches. Of course dropping page cache can be very bad for performance. Do not do this on a real server :-).
edited Nov 29 at 16:11
answered Nov 29 at 15:44
sourcejedi
22.3k43398
22.3k43398
add a comment |
add a comment |
1
Welcome to U&L! Yes, apparently it can. See, for example, this explanation from Red Hat. See the line: "Cached: Memory in the pagecache (Diskcache and Shared Memory)"
– fra-san
Nov 29 at 12:47