Results 1 to 8 of 8

Thread: Plasma 5 Memory widget wrong

  1. #1
    Join Date
    Dec 2008
    Location
    Norway
    Posts
    550

    Default Plasma 5 Memory widget wrong

    The Plasma 5 memory status widget I think reports wrong.

    While it reports I am using 9,6GB out of 32GB the command free reports something else.
    Code:
    mintaka:/ # free -h
                 total       used       free     shared    buffers     cached
    Mem:           31G        18G        12G       2,5G       652M       8,3G
    -/+ buffers/cache:       9,8G        21G
    Swap:           0B         0B         0B
    
    I started checking this out when my Eclipse IDE was reporting memory problems with "Unable to create new native thread".
    Also when this happens I started getting problems with my browser loading new tabs.

    With 12GB free memory I should not be getting any problems, but that is a different discussion.

    Why is the memory widget reporting my memory usage so much lower than free?
    I would like my dashboard/desktop to give me accurate information about my system.

  2. #2
    Join Date
    Jan 2016
    Location
    Manchester, UK
    Posts
    279

    Default Re: Plasma 5 Memory widget wrong

    Have you set TMPFS for any purpose? (Maybe you just have put your `/tmp` into memory as `tmpfs`.) I think the usage of TMPFS is not counted in the normal "used" number.

    But it still odd that you have no ram to use when `free` says it has 12G as free.
    Last edited by cnzhx; 15-May-2017 at 05:59. Reason: Add example of /tmp
    openSUSE Tumbleweed (usually the latest snapshot) w/ KDE Plasma 5

  3. #3

    Default Re: Plasma 5 Memory widget wrong

    Quote Originally Posted by DJViking View Post
    Why is the memory widget reporting my memory usage so much lower than free?
    I suppose it doesn't count the "buffers/cache", which are not really in use, but will rather be freed as necessary by the kernel.
    Last edited by wolfi323; 15-May-2017 at 06:30.

  4. #4
    Join Date
    Jan 2016
    Location
    Manchester, UK
    Posts
    279

    Default Re: Plasma 5 Memory widget wrong

    Quote Originally Posted by wolfi323 View Post
    I suppose it doesn't count the "buffers/cache", which are not really in use, but will rather be freed as necessary by the kernel.
    It's good to know that TMPFS usage is counted in "buffers/cache" :-)

    So, if I set a tmpfs for temporary use, like I put a large file in it, will it be freed by the kernel? If not, then that might be the reason the OP has no ram to use for this case.
    openSUSE Tumbleweed (usually the latest snapshot) w/ KDE Plasma 5

  5. #5

    Default Re: Plasma 5 Memory widget wrong

    Quote Originally Posted by cnzhx View Post
    It's good to know that TMPFS usage is counted in "buffers/cache" :-)
    I don't think it is.
    According to "man free":
    Code:
    The displayed columns are:
    ...
           shared Memory  used (mostly) by tmpfs (Shmem in /proc/meminfo, avail-
                  able on kernels 2.6.32, displayed as zero if not available)
    
           buffers
                  Memory used by kernel buffers (Buffers in /proc/meminfo)
    
           cached Memory used by the page cache (Cached in /proc/meminfo)
    So, if I set a tmpfs for temporary use, like I put a large file in it, will it be freed by the kernel? If not, then that might be the reason the OP has no ram to use for this case.
    Of course the kernel does not automatically delete files in /tmp. You can setup systemd to do that regularly (or do it via a cron job), but cleaning tmp is not done in openSUSE by default. (if /tmp is a tmpfs, it will be clean on reboot anyway though)

    I'm not sure whether the contents of a tmpfs would be swapped out, but that's irrelevant in this case anyway, as there is no swap.
    Last edited by wolfi323; 15-May-2017 at 07:59.

  6. #6
    Join Date
    Jan 2016
    Location
    Manchester, UK
    Posts
    279

    Default Re: Plasma 5 Memory widget wrong

    Quote Originally Posted by wolfi323 View Post
    I don't think it is.
    According to "man free":
    Code:
    The displayed columns are:
    ...
           shared Memory  used (mostly) by tmpfs (Shmem in /proc/meminfo, avail-
                  able on kernels 2.6.32, displayed as zero if not available)
    
           buffers
                  Memory used by kernel buffers (Buffers in /proc/meminfo)
    
           cached Memory used by the page cache (Cached in /proc/meminfo)
    I don't know this. But in fact, I have a temporary directory put into ram, using following statement in /etc/fstab,
    Code:
    tmpfs   /ztmp  tmpfs   rw,users,nodev,nosuid,size=12G  0 0
    And here is the outputs of `free -h` before and after I put a 2GB file into that folder,
    Code:
    cnzhx@a:~> free -h
                  total        used        free      shared  buff/cache   available
    Mem:            23G        1.7G         19G        524M        1.9G         20G
    Swap:          2.0G          0B        2.0G
    cnzhx@a:~> free -h
                  total        used        free      shared  buff/cache   available
    Mem:            23G        1.7G         17G        2.5G        3.9G         18G
    Swap:          2.0G          0B        2.0G
    So this 2GB file is counted both in "shared" and "buff/cache", and it's also subtracted from "free".

    Quote Originally Posted by wolfi323 View Post
    Of course the kernel does not automatically delete files in /tmp. You can setup systemd to do that regularly (or do it via a cron job), but cleaning tmp is not done in openSUSE by default. (if /tmp is a tmpfs, it will be clean on reboot anyway though)

    I'm not sure whether the contents of a tmpfs would be swapped out, but that's irrelevant in this case anyway, as there is no swap.
    It's good to know that the kernel will not automatically delete files in a manually set tmpfs directory :-) Other things doesn't matter then
    openSUSE Tumbleweed (usually the latest snapshot) w/ KDE Plasma 5

  7. #7

    Default Re: Plasma 5 Memory widget wrong

    Quote Originally Posted by cnzhx View Post
    So this 2GB file is counted both in "shared" and "buff/cache", and it's also subtracted from "free".
    Well, I am not sure about this, but what you describe doesn't necessarily mean that the 2GB file in the tmpfs is actually counted in "buff/cache".

    Copying the file to the tmpfs may have increased the buffers the kernel uses (after all the whole file gets read and written), and they would be freed again if necessary in that case, but the 2GB usage would stay in "shared" (and the other columns) even then.

  8. #8
    Join Date
    Jan 2016
    Location
    Manchester, UK
    Posts
    279

    Default Re: Plasma 5 Memory widget wrong

    Quote Originally Posted by wolfi323 View Post
    Well, I am not sure about this, but what you describe doesn't necessarily mean that the 2GB file in the tmpfs is actually counted in "buff/cache".

    Copying the file to the tmpfs may have increased the buffers the kernel uses (after all the whole file gets read and written), and they would be freed again if necessary in that case, but the 2GB usage would stay in "shared" (and the other columns) even then.
    It must be that. Then #3 post of yours should solve the OP's doubts, I think.
    openSUSE Tumbleweed (usually the latest snapshot) w/ KDE Plasma 5

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •