Difference between free -m and ps -euf
I have a vps machine with ubuntu 10.04 and 512Mb of RAM. I'm trying to guess how much memory is available after running the mongodb daemon.
If I run free -m
I get
total used free shared buffers cached
Mem: 496 489 6 0 4 452
-/+ buffers/cache: 33 462
Swap: 511 4 507
If I run ps euf
I get
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 948 0.0 0.0 5928 472 tty6 Ss+ Aug25 0:00 /sbin/getty 384
root 947 0.0 0.0 5928 472 tty5 Ss+ Aug25 0:00 /sbin/getty 384
root 946 0.0 0.0 5928 472 tty4 Ss+ Aug25 0:00 /sbin/getty 384
root 945 0.0 0.0 5928 472 tty3 Ss+ Aug25 0:00 /sbin/getty 384
root 944 0.0 0.0 5928 472 tty2 Ss+ Aug25 0:00 /sbin/getty 384
root 943 0.0 0.1 51856 536 hvc0 Ss Aug25 0:00 /bin/login --
root 978 0.0 0.4 20580 2424 hvc0 S Aug25 0:01 _ -bash TERM=
root 7593 0.0 0.1 10332 524 hvc0 T Aug25 0:00 _ nano he
root 12576 0.7 3.1 122520 16220 hvc0 Sl 07:42 0:12 _ ./mongo
root 12599 0.0 0.2 16300 1060 hvc0 R+ 08:09 0:00 _ ps euf
So it seems that less than 5% of memory is used by processes but I have only 6Mb of free memory... why?
memory ps
add a comment |
I have a vps machine with ubuntu 10.04 and 512Mb of RAM. I'm trying to guess how much memory is available after running the mongodb daemon.
If I run free -m
I get
total used free shared buffers cached
Mem: 496 489 6 0 4 452
-/+ buffers/cache: 33 462
Swap: 511 4 507
If I run ps euf
I get
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 948 0.0 0.0 5928 472 tty6 Ss+ Aug25 0:00 /sbin/getty 384
root 947 0.0 0.0 5928 472 tty5 Ss+ Aug25 0:00 /sbin/getty 384
root 946 0.0 0.0 5928 472 tty4 Ss+ Aug25 0:00 /sbin/getty 384
root 945 0.0 0.0 5928 472 tty3 Ss+ Aug25 0:00 /sbin/getty 384
root 944 0.0 0.0 5928 472 tty2 Ss+ Aug25 0:00 /sbin/getty 384
root 943 0.0 0.1 51856 536 hvc0 Ss Aug25 0:00 /bin/login --
root 978 0.0 0.4 20580 2424 hvc0 S Aug25 0:01 _ -bash TERM=
root 7593 0.0 0.1 10332 524 hvc0 T Aug25 0:00 _ nano he
root 12576 0.7 3.1 122520 16220 hvc0 Sl 07:42 0:12 _ ./mongo
root 12599 0.0 0.2 16300 1060 hvc0 R+ 08:09 0:00 _ ps euf
So it seems that less than 5% of memory is used by processes but I have only 6Mb of free memory... why?
memory ps
add a comment |
I have a vps machine with ubuntu 10.04 and 512Mb of RAM. I'm trying to guess how much memory is available after running the mongodb daemon.
If I run free -m
I get
total used free shared buffers cached
Mem: 496 489 6 0 4 452
-/+ buffers/cache: 33 462
Swap: 511 4 507
If I run ps euf
I get
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 948 0.0 0.0 5928 472 tty6 Ss+ Aug25 0:00 /sbin/getty 384
root 947 0.0 0.0 5928 472 tty5 Ss+ Aug25 0:00 /sbin/getty 384
root 946 0.0 0.0 5928 472 tty4 Ss+ Aug25 0:00 /sbin/getty 384
root 945 0.0 0.0 5928 472 tty3 Ss+ Aug25 0:00 /sbin/getty 384
root 944 0.0 0.0 5928 472 tty2 Ss+ Aug25 0:00 /sbin/getty 384
root 943 0.0 0.1 51856 536 hvc0 Ss Aug25 0:00 /bin/login --
root 978 0.0 0.4 20580 2424 hvc0 S Aug25 0:01 _ -bash TERM=
root 7593 0.0 0.1 10332 524 hvc0 T Aug25 0:00 _ nano he
root 12576 0.7 3.1 122520 16220 hvc0 Sl 07:42 0:12 _ ./mongo
root 12599 0.0 0.2 16300 1060 hvc0 R+ 08:09 0:00 _ ps euf
So it seems that less than 5% of memory is used by processes but I have only 6Mb of free memory... why?
memory ps
I have a vps machine with ubuntu 10.04 and 512Mb of RAM. I'm trying to guess how much memory is available after running the mongodb daemon.
If I run free -m
I get
total used free shared buffers cached
Mem: 496 489 6 0 4 452
-/+ buffers/cache: 33 462
Swap: 511 4 507
If I run ps euf
I get
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 948 0.0 0.0 5928 472 tty6 Ss+ Aug25 0:00 /sbin/getty 384
root 947 0.0 0.0 5928 472 tty5 Ss+ Aug25 0:00 /sbin/getty 384
root 946 0.0 0.0 5928 472 tty4 Ss+ Aug25 0:00 /sbin/getty 384
root 945 0.0 0.0 5928 472 tty3 Ss+ Aug25 0:00 /sbin/getty 384
root 944 0.0 0.0 5928 472 tty2 Ss+ Aug25 0:00 /sbin/getty 384
root 943 0.0 0.1 51856 536 hvc0 Ss Aug25 0:00 /bin/login --
root 978 0.0 0.4 20580 2424 hvc0 S Aug25 0:01 _ -bash TERM=
root 7593 0.0 0.1 10332 524 hvc0 T Aug25 0:00 _ nano he
root 12576 0.7 3.1 122520 16220 hvc0 Sl 07:42 0:12 _ ./mongo
root 12599 0.0 0.2 16300 1060 hvc0 R+ 08:09 0:00 _ ps euf
So it seems that less than 5% of memory is used by processes but I have only 6Mb of free memory... why?
memory ps
memory ps
edited 1 hour ago
Rui F Ribeiro
41.5k1483140
41.5k1483140
asked Aug 27 '11 at 15:11
mamoomamoo
1335
1335
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
The buffers and cache are dynamically sized. If processes need more space, then it is taken from the buffers and the cache.
The key is to look at the second line ("-/+ buffers/cache").
Mem: 496 489 6 0 4 452
-/+ buffers/cache: 33 462
Notice that the free in the second line (462) is the sum of 6 (free), 4 (buffers) and 452 (cached). This is the real amount of free space. If this falls too low, then the system would start swapping processes out of memory to swap space.
So in reality, you are using 33MB of memory and have available 462MB - probably slightly less since you would still need some buffers for i/o.
Great and clear explanation. Thanks!
– mamoo
Aug 27 '11 at 15:32
add a comment |
Apart from the correct explanation by Arcege, there are also two other misconceptions hidden in your interpretation of ps euf
.
The command
ps euf
does not list all the processes - you should useps axeuf
for that.Percentages of used memory for each process are given, as you can see, rounded to
0.1%
. So adding them up will give erroneous results - (roughly) all processes use some memory - even if it is less then0.1%
. If there are, for instance, 20 processes that use0.05%
, they'd add up to1%
, not0%
.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f19560%2fdifference-between-free-m-and-ps-euf%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The buffers and cache are dynamically sized. If processes need more space, then it is taken from the buffers and the cache.
The key is to look at the second line ("-/+ buffers/cache").
Mem: 496 489 6 0 4 452
-/+ buffers/cache: 33 462
Notice that the free in the second line (462) is the sum of 6 (free), 4 (buffers) and 452 (cached). This is the real amount of free space. If this falls too low, then the system would start swapping processes out of memory to swap space.
So in reality, you are using 33MB of memory and have available 462MB - probably slightly less since you would still need some buffers for i/o.
Great and clear explanation. Thanks!
– mamoo
Aug 27 '11 at 15:32
add a comment |
The buffers and cache are dynamically sized. If processes need more space, then it is taken from the buffers and the cache.
The key is to look at the second line ("-/+ buffers/cache").
Mem: 496 489 6 0 4 452
-/+ buffers/cache: 33 462
Notice that the free in the second line (462) is the sum of 6 (free), 4 (buffers) and 452 (cached). This is the real amount of free space. If this falls too low, then the system would start swapping processes out of memory to swap space.
So in reality, you are using 33MB of memory and have available 462MB - probably slightly less since you would still need some buffers for i/o.
Great and clear explanation. Thanks!
– mamoo
Aug 27 '11 at 15:32
add a comment |
The buffers and cache are dynamically sized. If processes need more space, then it is taken from the buffers and the cache.
The key is to look at the second line ("-/+ buffers/cache").
Mem: 496 489 6 0 4 452
-/+ buffers/cache: 33 462
Notice that the free in the second line (462) is the sum of 6 (free), 4 (buffers) and 452 (cached). This is the real amount of free space. If this falls too low, then the system would start swapping processes out of memory to swap space.
So in reality, you are using 33MB of memory and have available 462MB - probably slightly less since you would still need some buffers for i/o.
The buffers and cache are dynamically sized. If processes need more space, then it is taken from the buffers and the cache.
The key is to look at the second line ("-/+ buffers/cache").
Mem: 496 489 6 0 4 452
-/+ buffers/cache: 33 462
Notice that the free in the second line (462) is the sum of 6 (free), 4 (buffers) and 452 (cached). This is the real amount of free space. If this falls too low, then the system would start swapping processes out of memory to swap space.
So in reality, you are using 33MB of memory and have available 462MB - probably slightly less since you would still need some buffers for i/o.
answered Aug 27 '11 at 15:31
ArcegeArcege
17.3k44257
17.3k44257
Great and clear explanation. Thanks!
– mamoo
Aug 27 '11 at 15:32
add a comment |
Great and clear explanation. Thanks!
– mamoo
Aug 27 '11 at 15:32
Great and clear explanation. Thanks!
– mamoo
Aug 27 '11 at 15:32
Great and clear explanation. Thanks!
– mamoo
Aug 27 '11 at 15:32
add a comment |
Apart from the correct explanation by Arcege, there are also two other misconceptions hidden in your interpretation of ps euf
.
The command
ps euf
does not list all the processes - you should useps axeuf
for that.Percentages of used memory for each process are given, as you can see, rounded to
0.1%
. So adding them up will give erroneous results - (roughly) all processes use some memory - even if it is less then0.1%
. If there are, for instance, 20 processes that use0.05%
, they'd add up to1%
, not0%
.
add a comment |
Apart from the correct explanation by Arcege, there are also two other misconceptions hidden in your interpretation of ps euf
.
The command
ps euf
does not list all the processes - you should useps axeuf
for that.Percentages of used memory for each process are given, as you can see, rounded to
0.1%
. So adding them up will give erroneous results - (roughly) all processes use some memory - even if it is less then0.1%
. If there are, for instance, 20 processes that use0.05%
, they'd add up to1%
, not0%
.
add a comment |
Apart from the correct explanation by Arcege, there are also two other misconceptions hidden in your interpretation of ps euf
.
The command
ps euf
does not list all the processes - you should useps axeuf
for that.Percentages of used memory for each process are given, as you can see, rounded to
0.1%
. So adding them up will give erroneous results - (roughly) all processes use some memory - even if it is less then0.1%
. If there are, for instance, 20 processes that use0.05%
, they'd add up to1%
, not0%
.
Apart from the correct explanation by Arcege, there are also two other misconceptions hidden in your interpretation of ps euf
.
The command
ps euf
does not list all the processes - you should useps axeuf
for that.Percentages of used memory for each process are given, as you can see, rounded to
0.1%
. So adding them up will give erroneous results - (roughly) all processes use some memory - even if it is less then0.1%
. If there are, for instance, 20 processes that use0.05%
, they'd add up to1%
, not0%
.
edited Apr 13 '17 at 12:36
Community♦
1
1
answered Aug 27 '11 at 21:43
rozcietrzewiaczrozcietrzewiacz
29.4k47392
29.4k47392
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f19560%2fdifference-between-free-m-and-ps-euf%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown