Top: DATA = RES + stack + what?

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I've analyzed memory consumption of a java program on Linux Mint. I used top to capture memory statistics (memory used by program and also system-wide indicators like total_mem_used and mem_free). The results were surprising:
- "used physical memory" (
RAM_USE_DELTAon chart) increased and "free physical memory" (revertedRAM_FREE_DELTAon chart) decreased the same amount the RES (P_RSSon chart) increased - this is what I expected - the DATA (
P_DATAon chart) field (described intop's man as "the amount of physical memory devoted to other than executable code") was 150 megs above RES. - SWAP (
SWAP_USE_DELTAon chart) was zero all the time - SHR (shared memory;
P_SHRon chart) was less than 15MB
The question is: what was counted in the aforementioned 150MB? Virtual (reserved but not allocated) stack? Memory mapped files? As I wrote before: RES ~ RAM_USED_DELTA so the amount of free memory did NOT decrease by 150MB so it may indicate virtual memory but it would be weird for a memory indicator to be a sum of a resident set and a virtual amount...

(on this chart lines described *_DELTA are relative to the start of the program i.e. close to the left side, where red P_RSS starts)
memory top stack
add a comment |Â
up vote
0
down vote
favorite
I've analyzed memory consumption of a java program on Linux Mint. I used top to capture memory statistics (memory used by program and also system-wide indicators like total_mem_used and mem_free). The results were surprising:
- "used physical memory" (
RAM_USE_DELTAon chart) increased and "free physical memory" (revertedRAM_FREE_DELTAon chart) decreased the same amount the RES (P_RSSon chart) increased - this is what I expected - the DATA (
P_DATAon chart) field (described intop's man as "the amount of physical memory devoted to other than executable code") was 150 megs above RES. - SWAP (
SWAP_USE_DELTAon chart) was zero all the time - SHR (shared memory;
P_SHRon chart) was less than 15MB
The question is: what was counted in the aforementioned 150MB? Virtual (reserved but not allocated) stack? Memory mapped files? As I wrote before: RES ~ RAM_USED_DELTA so the amount of free memory did NOT decrease by 150MB so it may indicate virtual memory but it would be weird for a memory indicator to be a sum of a resident set and a virtual amount...

(on this chart lines described *_DELTA are relative to the start of the program i.e. close to the left side, where red P_RSS starts)
memory top stack
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I've analyzed memory consumption of a java program on Linux Mint. I used top to capture memory statistics (memory used by program and also system-wide indicators like total_mem_used and mem_free). The results were surprising:
- "used physical memory" (
RAM_USE_DELTAon chart) increased and "free physical memory" (revertedRAM_FREE_DELTAon chart) decreased the same amount the RES (P_RSSon chart) increased - this is what I expected - the DATA (
P_DATAon chart) field (described intop's man as "the amount of physical memory devoted to other than executable code") was 150 megs above RES. - SWAP (
SWAP_USE_DELTAon chart) was zero all the time - SHR (shared memory;
P_SHRon chart) was less than 15MB
The question is: what was counted in the aforementioned 150MB? Virtual (reserved but not allocated) stack? Memory mapped files? As I wrote before: RES ~ RAM_USED_DELTA so the amount of free memory did NOT decrease by 150MB so it may indicate virtual memory but it would be weird for a memory indicator to be a sum of a resident set and a virtual amount...

(on this chart lines described *_DELTA are relative to the start of the program i.e. close to the left side, where red P_RSS starts)
memory top stack
I've analyzed memory consumption of a java program on Linux Mint. I used top to capture memory statistics (memory used by program and also system-wide indicators like total_mem_used and mem_free). The results were surprising:
- "used physical memory" (
RAM_USE_DELTAon chart) increased and "free physical memory" (revertedRAM_FREE_DELTAon chart) decreased the same amount the RES (P_RSSon chart) increased - this is what I expected - the DATA (
P_DATAon chart) field (described intop's man as "the amount of physical memory devoted to other than executable code") was 150 megs above RES. - SWAP (
SWAP_USE_DELTAon chart) was zero all the time - SHR (shared memory;
P_SHRon chart) was less than 15MB
The question is: what was counted in the aforementioned 150MB? Virtual (reserved but not allocated) stack? Memory mapped files? As I wrote before: RES ~ RAM_USED_DELTA so the amount of free memory did NOT decrease by 150MB so it may indicate virtual memory but it would be weird for a memory indicator to be a sum of a resident set and a virtual amount...

(on this chart lines described *_DELTA are relative to the start of the program i.e. close to the left side, where red P_RSS starts)
memory top stack
memory top stack
asked Oct 10 '17 at 21:08
rychu
101
101
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
The field DATA is the virtual memory of the process allocated for stuff which is not executable code, that is to say, data; it includes static data, the stack, and dynamically allocated memory; together with the field CODE it is included in the total VIRTual memory. The RESident size is the amount of virtual memory which is actually in RAM; it consists of part of the CODE, part of the DATA and part of other things such as memory mapped files.
You will notice that there is no direct relationship between VIRT, CODE, DATA and RES. The CODE comes from the compiler; the VIRT and DATA are under the control of the process (malloc(), free(), mmap(), and so on); the RES part is controlled by the operating system.
1. but VIRT is exactly 4399904 all the time, doesn't change while DATA has a few 50MB increases. 2. I've already made a simple c program to check the VIRT and RES relation - it mallocs a lot of memory and either fills it or not so VIRT may be as high as I want and RES may still stay low. How can I keep DATA int the middle?
â rychu
Oct 11 '17 at 5:06
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
The field DATA is the virtual memory of the process allocated for stuff which is not executable code, that is to say, data; it includes static data, the stack, and dynamically allocated memory; together with the field CODE it is included in the total VIRTual memory. The RESident size is the amount of virtual memory which is actually in RAM; it consists of part of the CODE, part of the DATA and part of other things such as memory mapped files.
You will notice that there is no direct relationship between VIRT, CODE, DATA and RES. The CODE comes from the compiler; the VIRT and DATA are under the control of the process (malloc(), free(), mmap(), and so on); the RES part is controlled by the operating system.
1. but VIRT is exactly 4399904 all the time, doesn't change while DATA has a few 50MB increases. 2. I've already made a simple c program to check the VIRT and RES relation - it mallocs a lot of memory and either fills it or not so VIRT may be as high as I want and RES may still stay low. How can I keep DATA int the middle?
â rychu
Oct 11 '17 at 5:06
add a comment |Â
up vote
0
down vote
The field DATA is the virtual memory of the process allocated for stuff which is not executable code, that is to say, data; it includes static data, the stack, and dynamically allocated memory; together with the field CODE it is included in the total VIRTual memory. The RESident size is the amount of virtual memory which is actually in RAM; it consists of part of the CODE, part of the DATA and part of other things such as memory mapped files.
You will notice that there is no direct relationship between VIRT, CODE, DATA and RES. The CODE comes from the compiler; the VIRT and DATA are under the control of the process (malloc(), free(), mmap(), and so on); the RES part is controlled by the operating system.
1. but VIRT is exactly 4399904 all the time, doesn't change while DATA has a few 50MB increases. 2. I've already made a simple c program to check the VIRT and RES relation - it mallocs a lot of memory and either fills it or not so VIRT may be as high as I want and RES may still stay low. How can I keep DATA int the middle?
â rychu
Oct 11 '17 at 5:06
add a comment |Â
up vote
0
down vote
up vote
0
down vote
The field DATA is the virtual memory of the process allocated for stuff which is not executable code, that is to say, data; it includes static data, the stack, and dynamically allocated memory; together with the field CODE it is included in the total VIRTual memory. The RESident size is the amount of virtual memory which is actually in RAM; it consists of part of the CODE, part of the DATA and part of other things such as memory mapped files.
You will notice that there is no direct relationship between VIRT, CODE, DATA and RES. The CODE comes from the compiler; the VIRT and DATA are under the control of the process (malloc(), free(), mmap(), and so on); the RES part is controlled by the operating system.
The field DATA is the virtual memory of the process allocated for stuff which is not executable code, that is to say, data; it includes static data, the stack, and dynamically allocated memory; together with the field CODE it is included in the total VIRTual memory. The RESident size is the amount of virtual memory which is actually in RAM; it consists of part of the CODE, part of the DATA and part of other things such as memory mapped files.
You will notice that there is no direct relationship between VIRT, CODE, DATA and RES. The CODE comes from the compiler; the VIRT and DATA are under the control of the process (malloc(), free(), mmap(), and so on); the RES part is controlled by the operating system.
answered Oct 10 '17 at 22:31
AlexP
6,656924
6,656924
1. but VIRT is exactly 4399904 all the time, doesn't change while DATA has a few 50MB increases. 2. I've already made a simple c program to check the VIRT and RES relation - it mallocs a lot of memory and either fills it or not so VIRT may be as high as I want and RES may still stay low. How can I keep DATA int the middle?
â rychu
Oct 11 '17 at 5:06
add a comment |Â
1. but VIRT is exactly 4399904 all the time, doesn't change while DATA has a few 50MB increases. 2. I've already made a simple c program to check the VIRT and RES relation - it mallocs a lot of memory and either fills it or not so VIRT may be as high as I want and RES may still stay low. How can I keep DATA int the middle?
â rychu
Oct 11 '17 at 5:06
1. but VIRT is exactly 4399904 all the time, doesn't change while DATA has a few 50MB increases. 2. I've already made a simple c program to check the VIRT and RES relation - it mallocs a lot of memory and either fills it or not so VIRT may be as high as I want and RES may still stay low. How can I keep DATA int the middle?
â rychu
Oct 11 '17 at 5:06
1. but VIRT is exactly 4399904 all the time, doesn't change while DATA has a few 50MB increases. 2. I've already made a simple c program to check the VIRT and RES relation - it mallocs a lot of memory and either fills it or not so VIRT may be as high as I want and RES may still stay low. How can I keep DATA int the middle?
â rychu
Oct 11 '17 at 5:06
add a comment |Â
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f397304%2ftop-data-res-stack-what%23new-answer', 'question_page');
);
Post as a guest
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
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
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