Memory usage doesn't add up - what is using my memory?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







2















My computer (which is running Ubuntu Server 16.04) is currently using 13.4 GB out of 15.4 GB of RAM (according to htop) but I'm struggling to understand what is using that memory.



free -m reports:



              total        used        free      shared  buff/cache   available
Mem: 15733 13781 1083 22 868 1592
Swap: 71524 430 71094


top shows the highest memory using process as taking 6.8% of memory and the next largest taking 0.4% of memory.



If I use ps aux | awk '{print $6/1024 " MBtt" $11}' | sort -n, it shows the (same) highest-memory-using process as taking 1104 MB of RAM, which sounds about right compared to top.



If I sum all the values of every process reported by ps:



ps aux | awk '{sum=sum+$6}; END {print sum/1024 " MB"}'


it reports a total of 1.8 GB RAM used.



So ps reckons I'm using 1.8 GB RAM, but free and htop both reckon I'm using over 13 GB of RAM. The available column in the free output is too small to account for this difference.



What am I missing?



Edit 2017-01-20 13:27 Z



/usr/bin/free -h reports:




total used free shared buff/cache available
Mem: 15G 13G 417M 22M 1.1G 1.2G
Swap: 69G 432M 69G



slabtop output:



$ sudo slabtop -s c -o | head -n 20
Active / Total Objects (% used) : 16552394 / 17903627 (92.5%)
Active / Total Slabs (% used) : 841391 / 841391 (100.0%)
Active / Total Caches (% used) : 109 / 155 (70.3%)
Active / Total Size (% used) : 9510904.12K / 9753117.86K (97.5%)
Minimum / Average / Maximum Object : 0.01K / 0.54K / 18.56K

OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME
1764956 1764890 0% 1.08K 120388 29 3852416K zio_cache
126780 126308 0% 16.00K 68205 2 2182560K zio_buf_16384
1797996 1797996 100% 0.85K 100920 18 1614720K dnode_t
1952240 1833842 0% 0.50K 122015 16 976120K kmalloc-512
62255 61308 0% 8.00K 20096 4 643072K kmalloc-8192
1999648 1968319 0% 0.28K 71416 28 571328K dmu_buf_impl_t
1764892 1764892 100% 0.26K 56932 31 455456K sa_cache
2028978 1981994 0% 0.19K 96618 21 386472K dentry
23113 23021 0% 12.00K 11557 2 369824K zio_buf_12288
694975 647514 0% 0.31K 27799 25 222392K bio-1
1660096 1592262 0% 0.12K 51878 32 207512K kmalloc-128
131376 91798 0% 1.00K 8211 16 131376K ecryptfs_inode_cache
90888 89352 0% 1.05K 3035 30 97120K ext4_inode_cache

$ sudo slabtop -s c -o | tail -n +8 | awk '{sum=sum+$7}; END {print sum/1024 " MB"}'` reports:
11484.9 MB

$ sudo slabtop -s c -o | tail -n +8 | grep zio | awk '{sum=sum+$7}; END {print sum/1024 " MB"}'
6222.28 MB


So it looks like it's something to do ZFS from what I can tell - ZFS is taking over 6 GB of RAM and there's about 5 GB used by non-zio stuff in the slabtop output.










share|improve this question




















  • 1





    have a look at this thread: askubuntu.com/questions/285387/… slabtop -s c may give you a hint on what is using your memory. In my case it was ext4_inode_cache - in the linked thread is was the XFS equivalent to it.

    – Phillip -Zyan K Lee- Stockmann
    Jan 20 '17 at 12:34






  • 1





    It seems you're using the "old" output format of free that doesn't list buffers and caches. Could you please run free -h without the -o option and include the output in your question? If free is an alias that implies -o, you can circumvent it with command free -h. Alternatively, what's the output of grep -e '^MemAvailable:' /proc/meminfo? Thanks.

    – David Foerster
    Jan 20 '17 at 12:56













  • Thanks you both - I've added the output from free and slabtop.

    – DrAl
    Jan 20 '17 at 13:29


















2















My computer (which is running Ubuntu Server 16.04) is currently using 13.4 GB out of 15.4 GB of RAM (according to htop) but I'm struggling to understand what is using that memory.



free -m reports:



              total        used        free      shared  buff/cache   available
Mem: 15733 13781 1083 22 868 1592
Swap: 71524 430 71094


top shows the highest memory using process as taking 6.8% of memory and the next largest taking 0.4% of memory.



If I use ps aux | awk '{print $6/1024 " MBtt" $11}' | sort -n, it shows the (same) highest-memory-using process as taking 1104 MB of RAM, which sounds about right compared to top.



If I sum all the values of every process reported by ps:



ps aux | awk '{sum=sum+$6}; END {print sum/1024 " MB"}'


it reports a total of 1.8 GB RAM used.



So ps reckons I'm using 1.8 GB RAM, but free and htop both reckon I'm using over 13 GB of RAM. The available column in the free output is too small to account for this difference.



What am I missing?



Edit 2017-01-20 13:27 Z



/usr/bin/free -h reports:




total used free shared buff/cache available
Mem: 15G 13G 417M 22M 1.1G 1.2G
Swap: 69G 432M 69G



slabtop output:



$ sudo slabtop -s c -o | head -n 20
Active / Total Objects (% used) : 16552394 / 17903627 (92.5%)
Active / Total Slabs (% used) : 841391 / 841391 (100.0%)
Active / Total Caches (% used) : 109 / 155 (70.3%)
Active / Total Size (% used) : 9510904.12K / 9753117.86K (97.5%)
Minimum / Average / Maximum Object : 0.01K / 0.54K / 18.56K

OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME
1764956 1764890 0% 1.08K 120388 29 3852416K zio_cache
126780 126308 0% 16.00K 68205 2 2182560K zio_buf_16384
1797996 1797996 100% 0.85K 100920 18 1614720K dnode_t
1952240 1833842 0% 0.50K 122015 16 976120K kmalloc-512
62255 61308 0% 8.00K 20096 4 643072K kmalloc-8192
1999648 1968319 0% 0.28K 71416 28 571328K dmu_buf_impl_t
1764892 1764892 100% 0.26K 56932 31 455456K sa_cache
2028978 1981994 0% 0.19K 96618 21 386472K dentry
23113 23021 0% 12.00K 11557 2 369824K zio_buf_12288
694975 647514 0% 0.31K 27799 25 222392K bio-1
1660096 1592262 0% 0.12K 51878 32 207512K kmalloc-128
131376 91798 0% 1.00K 8211 16 131376K ecryptfs_inode_cache
90888 89352 0% 1.05K 3035 30 97120K ext4_inode_cache

$ sudo slabtop -s c -o | tail -n +8 | awk '{sum=sum+$7}; END {print sum/1024 " MB"}'` reports:
11484.9 MB

$ sudo slabtop -s c -o | tail -n +8 | grep zio | awk '{sum=sum+$7}; END {print sum/1024 " MB"}'
6222.28 MB


So it looks like it's something to do ZFS from what I can tell - ZFS is taking over 6 GB of RAM and there's about 5 GB used by non-zio stuff in the slabtop output.










share|improve this question




















  • 1





    have a look at this thread: askubuntu.com/questions/285387/… slabtop -s c may give you a hint on what is using your memory. In my case it was ext4_inode_cache - in the linked thread is was the XFS equivalent to it.

    – Phillip -Zyan K Lee- Stockmann
    Jan 20 '17 at 12:34






  • 1





    It seems you're using the "old" output format of free that doesn't list buffers and caches. Could you please run free -h without the -o option and include the output in your question? If free is an alias that implies -o, you can circumvent it with command free -h. Alternatively, what's the output of grep -e '^MemAvailable:' /proc/meminfo? Thanks.

    – David Foerster
    Jan 20 '17 at 12:56













  • Thanks you both - I've added the output from free and slabtop.

    – DrAl
    Jan 20 '17 at 13:29














2












2








2








My computer (which is running Ubuntu Server 16.04) is currently using 13.4 GB out of 15.4 GB of RAM (according to htop) but I'm struggling to understand what is using that memory.



free -m reports:



              total        used        free      shared  buff/cache   available
Mem: 15733 13781 1083 22 868 1592
Swap: 71524 430 71094


top shows the highest memory using process as taking 6.8% of memory and the next largest taking 0.4% of memory.



If I use ps aux | awk '{print $6/1024 " MBtt" $11}' | sort -n, it shows the (same) highest-memory-using process as taking 1104 MB of RAM, which sounds about right compared to top.



If I sum all the values of every process reported by ps:



ps aux | awk '{sum=sum+$6}; END {print sum/1024 " MB"}'


it reports a total of 1.8 GB RAM used.



So ps reckons I'm using 1.8 GB RAM, but free and htop both reckon I'm using over 13 GB of RAM. The available column in the free output is too small to account for this difference.



What am I missing?



Edit 2017-01-20 13:27 Z



/usr/bin/free -h reports:




total used free shared buff/cache available
Mem: 15G 13G 417M 22M 1.1G 1.2G
Swap: 69G 432M 69G



slabtop output:



$ sudo slabtop -s c -o | head -n 20
Active / Total Objects (% used) : 16552394 / 17903627 (92.5%)
Active / Total Slabs (% used) : 841391 / 841391 (100.0%)
Active / Total Caches (% used) : 109 / 155 (70.3%)
Active / Total Size (% used) : 9510904.12K / 9753117.86K (97.5%)
Minimum / Average / Maximum Object : 0.01K / 0.54K / 18.56K

OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME
1764956 1764890 0% 1.08K 120388 29 3852416K zio_cache
126780 126308 0% 16.00K 68205 2 2182560K zio_buf_16384
1797996 1797996 100% 0.85K 100920 18 1614720K dnode_t
1952240 1833842 0% 0.50K 122015 16 976120K kmalloc-512
62255 61308 0% 8.00K 20096 4 643072K kmalloc-8192
1999648 1968319 0% 0.28K 71416 28 571328K dmu_buf_impl_t
1764892 1764892 100% 0.26K 56932 31 455456K sa_cache
2028978 1981994 0% 0.19K 96618 21 386472K dentry
23113 23021 0% 12.00K 11557 2 369824K zio_buf_12288
694975 647514 0% 0.31K 27799 25 222392K bio-1
1660096 1592262 0% 0.12K 51878 32 207512K kmalloc-128
131376 91798 0% 1.00K 8211 16 131376K ecryptfs_inode_cache
90888 89352 0% 1.05K 3035 30 97120K ext4_inode_cache

$ sudo slabtop -s c -o | tail -n +8 | awk '{sum=sum+$7}; END {print sum/1024 " MB"}'` reports:
11484.9 MB

$ sudo slabtop -s c -o | tail -n +8 | grep zio | awk '{sum=sum+$7}; END {print sum/1024 " MB"}'
6222.28 MB


So it looks like it's something to do ZFS from what I can tell - ZFS is taking over 6 GB of RAM and there's about 5 GB used by non-zio stuff in the slabtop output.










share|improve this question
















My computer (which is running Ubuntu Server 16.04) is currently using 13.4 GB out of 15.4 GB of RAM (according to htop) but I'm struggling to understand what is using that memory.



free -m reports:



              total        used        free      shared  buff/cache   available
Mem: 15733 13781 1083 22 868 1592
Swap: 71524 430 71094


top shows the highest memory using process as taking 6.8% of memory and the next largest taking 0.4% of memory.



If I use ps aux | awk '{print $6/1024 " MBtt" $11}' | sort -n, it shows the (same) highest-memory-using process as taking 1104 MB of RAM, which sounds about right compared to top.



If I sum all the values of every process reported by ps:



ps aux | awk '{sum=sum+$6}; END {print sum/1024 " MB"}'


it reports a total of 1.8 GB RAM used.



So ps reckons I'm using 1.8 GB RAM, but free and htop both reckon I'm using over 13 GB of RAM. The available column in the free output is too small to account for this difference.



What am I missing?



Edit 2017-01-20 13:27 Z



/usr/bin/free -h reports:




total used free shared buff/cache available
Mem: 15G 13G 417M 22M 1.1G 1.2G
Swap: 69G 432M 69G



slabtop output:



$ sudo slabtop -s c -o | head -n 20
Active / Total Objects (% used) : 16552394 / 17903627 (92.5%)
Active / Total Slabs (% used) : 841391 / 841391 (100.0%)
Active / Total Caches (% used) : 109 / 155 (70.3%)
Active / Total Size (% used) : 9510904.12K / 9753117.86K (97.5%)
Minimum / Average / Maximum Object : 0.01K / 0.54K / 18.56K

OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME
1764956 1764890 0% 1.08K 120388 29 3852416K zio_cache
126780 126308 0% 16.00K 68205 2 2182560K zio_buf_16384
1797996 1797996 100% 0.85K 100920 18 1614720K dnode_t
1952240 1833842 0% 0.50K 122015 16 976120K kmalloc-512
62255 61308 0% 8.00K 20096 4 643072K kmalloc-8192
1999648 1968319 0% 0.28K 71416 28 571328K dmu_buf_impl_t
1764892 1764892 100% 0.26K 56932 31 455456K sa_cache
2028978 1981994 0% 0.19K 96618 21 386472K dentry
23113 23021 0% 12.00K 11557 2 369824K zio_buf_12288
694975 647514 0% 0.31K 27799 25 222392K bio-1
1660096 1592262 0% 0.12K 51878 32 207512K kmalloc-128
131376 91798 0% 1.00K 8211 16 131376K ecryptfs_inode_cache
90888 89352 0% 1.05K 3035 30 97120K ext4_inode_cache

$ sudo slabtop -s c -o | tail -n +8 | awk '{sum=sum+$7}; END {print sum/1024 " MB"}'` reports:
11484.9 MB

$ sudo slabtop -s c -o | tail -n +8 | grep zio | awk '{sum=sum+$7}; END {print sum/1024 " MB"}'
6222.28 MB


So it looks like it's something to do ZFS from what I can tell - ZFS is taking over 6 GB of RAM and there's about 5 GB used by non-zio stuff in the slabtop output.







ram memory-usage






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 20 '17 at 13:28







DrAl

















asked Jan 20 '17 at 12:14









DrAlDrAl

709816




709816








  • 1





    have a look at this thread: askubuntu.com/questions/285387/… slabtop -s c may give you a hint on what is using your memory. In my case it was ext4_inode_cache - in the linked thread is was the XFS equivalent to it.

    – Phillip -Zyan K Lee- Stockmann
    Jan 20 '17 at 12:34






  • 1





    It seems you're using the "old" output format of free that doesn't list buffers and caches. Could you please run free -h without the -o option and include the output in your question? If free is an alias that implies -o, you can circumvent it with command free -h. Alternatively, what's the output of grep -e '^MemAvailable:' /proc/meminfo? Thanks.

    – David Foerster
    Jan 20 '17 at 12:56













  • Thanks you both - I've added the output from free and slabtop.

    – DrAl
    Jan 20 '17 at 13:29














  • 1





    have a look at this thread: askubuntu.com/questions/285387/… slabtop -s c may give you a hint on what is using your memory. In my case it was ext4_inode_cache - in the linked thread is was the XFS equivalent to it.

    – Phillip -Zyan K Lee- Stockmann
    Jan 20 '17 at 12:34






  • 1





    It seems you're using the "old" output format of free that doesn't list buffers and caches. Could you please run free -h without the -o option and include the output in your question? If free is an alias that implies -o, you can circumvent it with command free -h. Alternatively, what's the output of grep -e '^MemAvailable:' /proc/meminfo? Thanks.

    – David Foerster
    Jan 20 '17 at 12:56













  • Thanks you both - I've added the output from free and slabtop.

    – DrAl
    Jan 20 '17 at 13:29








1




1





have a look at this thread: askubuntu.com/questions/285387/… slabtop -s c may give you a hint on what is using your memory. In my case it was ext4_inode_cache - in the linked thread is was the XFS equivalent to it.

– Phillip -Zyan K Lee- Stockmann
Jan 20 '17 at 12:34





have a look at this thread: askubuntu.com/questions/285387/… slabtop -s c may give you a hint on what is using your memory. In my case it was ext4_inode_cache - in the linked thread is was the XFS equivalent to it.

– Phillip -Zyan K Lee- Stockmann
Jan 20 '17 at 12:34




1




1





It seems you're using the "old" output format of free that doesn't list buffers and caches. Could you please run free -h without the -o option and include the output in your question? If free is an alias that implies -o, you can circumvent it with command free -h. Alternatively, what's the output of grep -e '^MemAvailable:' /proc/meminfo? Thanks.

– David Foerster
Jan 20 '17 at 12:56







It seems you're using the "old" output format of free that doesn't list buffers and caches. Could you please run free -h without the -o option and include the output in your question? If free is an alias that implies -o, you can circumvent it with command free -h. Alternatively, what's the output of grep -e '^MemAvailable:' /proc/meminfo? Thanks.

– David Foerster
Jan 20 '17 at 12:56















Thanks you both - I've added the output from free and slabtop.

– DrAl
Jan 20 '17 at 13:29





Thanks you both - I've added the output from free and slabtop.

– DrAl
Jan 20 '17 at 13:29










1 Answer
1






active

oldest

votes


















0














In my case, some memory is reserved for hugepage. Considering the hugepages reserved memory, it adds up.



controller-0:/home/wrsroot# grep -i huge /proc/meminfo
HugePages_Total: 1000
HugePages_Free: 488
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB




share








New contributor




Cheng1 Li is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    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: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    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
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f874147%2fmemory-usage-doesnt-add-up-what-is-using-my-memory%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    In my case, some memory is reserved for hugepage. Considering the hugepages reserved memory, it adds up.



    controller-0:/home/wrsroot# grep -i huge /proc/meminfo
    HugePages_Total: 1000
    HugePages_Free: 488
    HugePages_Rsvd: 0
    HugePages_Surp: 0
    Hugepagesize: 2048 kB




    share








    New contributor




    Cheng1 Li is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.

























      0














      In my case, some memory is reserved for hugepage. Considering the hugepages reserved memory, it adds up.



      controller-0:/home/wrsroot# grep -i huge /proc/meminfo
      HugePages_Total: 1000
      HugePages_Free: 488
      HugePages_Rsvd: 0
      HugePages_Surp: 0
      Hugepagesize: 2048 kB




      share








      New contributor




      Cheng1 Li is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.























        0












        0








        0







        In my case, some memory is reserved for hugepage. Considering the hugepages reserved memory, it adds up.



        controller-0:/home/wrsroot# grep -i huge /proc/meminfo
        HugePages_Total: 1000
        HugePages_Free: 488
        HugePages_Rsvd: 0
        HugePages_Surp: 0
        Hugepagesize: 2048 kB




        share








        New contributor




        Cheng1 Li is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.










        In my case, some memory is reserved for hugepage. Considering the hugepages reserved memory, it adds up.



        controller-0:/home/wrsroot# grep -i huge /proc/meminfo
        HugePages_Total: 1000
        HugePages_Free: 488
        HugePages_Rsvd: 0
        HugePages_Surp: 0
        Hugepagesize: 2048 kB





        share








        New contributor




        Cheng1 Li is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.








        share


        share






        New contributor




        Cheng1 Li is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered 3 mins ago









        Cheng1 LiCheng1 Li

        1




        1




        New contributor




        Cheng1 Li is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        Cheng1 Li is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        Cheng1 Li is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • 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.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f874147%2fmemory-usage-doesnt-add-up-what-is-using-my-memory%23new-answer', 'question_page');
            }
            );

            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







            Popular posts from this blog

            GameSpot

            connect to host localhost port 22: Connection refused

            Getting a Wifi WPA2 wifi connection