Top: DATA = RES + stack + what?

The name of the pictureThe name of the pictureThe name of the pictureClash 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_DELTA on chart) increased and "free physical memory" (reverted RAM_FREE_DELTA on chart) decreased the same amount the RES (P_RSS on chart) increased - this is what I expected

  • the DATA (P_DATA on chart) field (described in top's man as "the amount of physical memory devoted to other than executable code") was 150 megs above RES.

  • SWAP (SWAP_USE_DELTA on chart) was zero all the time

  • SHR (shared memory; P_SHR on 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...



memory usage chart



(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)










share|improve this question

























    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_DELTA on chart) increased and "free physical memory" (reverted RAM_FREE_DELTA on chart) decreased the same amount the RES (P_RSS on chart) increased - this is what I expected

    • the DATA (P_DATA on chart) field (described in top's man as "the amount of physical memory devoted to other than executable code") was 150 megs above RES.

    • SWAP (SWAP_USE_DELTA on chart) was zero all the time

    • SHR (shared memory; P_SHR on 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...



    memory usage chart



    (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)










    share|improve this question























      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_DELTA on chart) increased and "free physical memory" (reverted RAM_FREE_DELTA on chart) decreased the same amount the RES (P_RSS on chart) increased - this is what I expected

      • the DATA (P_DATA on chart) field (described in top's man as "the amount of physical memory devoted to other than executable code") was 150 megs above RES.

      • SWAP (SWAP_USE_DELTA on chart) was zero all the time

      • SHR (shared memory; P_SHR on 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...



      memory usage chart



      (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)










      share|improve this question













      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_DELTA on chart) increased and "free physical memory" (reverted RAM_FREE_DELTA on chart) decreased the same amount the RES (P_RSS on chart) increased - this is what I expected

      • the DATA (P_DATA on chart) field (described in top's man as "the amount of physical memory devoted to other than executable code") was 150 megs above RES.

      • SWAP (SWAP_USE_DELTA on chart) was zero all the time

      • SHR (shared memory; P_SHR on 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...



      memory usage chart



      (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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Oct 10 '17 at 21:08









      rychu

      101




      101




















          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.






          share|improve this answer




















          • 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











          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',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          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






























          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.






          share|improve this answer




















          • 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















          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.






          share|improve this answer




















          • 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













          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.






          share|improve this answer












          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.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          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

















          • 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


















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          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













































































          Popular posts from this blog

          Peggy Mitchell

          Palaiologos

          The Forum (Inglewood, California)