Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Ram memory usage, strangly high
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
AndrewAmmerlaan
Developer
Developer


Joined: 25 Jun 2014
Posts: 262
Location: Nijmegen

PostPosted: Fri Feb 09, 2018 9:07 pm    Post subject: Ram memory usage, strangly high Reply with quote

Hi all,

I'm curious as to why I keep running out of ram, even though it should be enough. So here's the thing when I check top I see this:
Code:

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND 
6457 andrew    20   0 17.003g 6.342g  20.3m S  58.1 40.7 340:18.08 java                                                                                       
16610 andrew    20   0 4689.1m 142.0m  30.0m S  14.0  0.9  46:55.88 clementine                                                                                 
16489 andrew    20   0 3403.3m  50.4m  21.6m S   8.3  0.3  27:02.87 kwin_x11                                                                                   
16302 root      20   0  525.7m  44.8m  30.3m S   8.0  0.3  24:21.35 X                                                                                           
17110 andrew    20   0 2622.8m 489.6m  72.3m S   7.6  3.1   2:34.77 Web Content                                                                                 
16718 andrew    20   0 2687.0m 221.0m  45.7m S   5.6  1.4  20:54.59 thunderbird                                                                                 
16507 andrew    20   0 5350.4m 215.5m  43.3m S   5.3  1.4  16:49.20 plasmashell                                                                                 
16962 andrew    20   0 2852.8m 624.7m  77.6m S   4.3  3.9   5:37.33 Web Content                                                                                 
16703 andrew    20   0 9816.5m 772.7m  77.1m S   3.0  4.8  11:24.02 firefox                                                                                     
16583 andrew     9 -11 4609.1m  26.9m  22.5m S   2.7  0.2   9:39.67 pulseaudio                                                                                 
16594 andrew    20   0  933.2m  72.1m  48.0m S   1.0  0.5   0:15.71 yakuake                                                                                     
32633 andrew    20   0 1554.5m  75.4m  40.8m S   1.0  0.5   0:49.03 Discord


As you can see the java process is using about 6.5GB, without java running my system runs at about 2 to 3 GB. Lets make that 4 just to be safe. Thus the memory used by running processes is about 10.5GB. So far so good, that should fit in the 16 I have available. Now this is what free shows me:

Code:

andrew@Andrew-Gentoo ~ $ free -h
              total        used        free      shared  buff/cache   available
Mem:            15G         14G        322M        384M        990M        1.3G
Swap:          7.1G        1.1G        6.0G


So there's an buff/cache and shared part that adds an extra 1.5GB, Lets add that to the 10.5GB, which makes 12GB as an estimate that is significantly rounded up. Now I have been reading up on how linux manages ram, and how it will fill empty ram with buff/cache, but the cache is to small to explain all extra memory usage. What is using the remaining unaccounted for 2+GB?

Why is this a problem? Well it's not a very big one, but I curious as to what's going on here. And waiting for an application to get pulled out of swap gets annoying after a while. I can of course reduce -xmx in java, but I'd rather have more information on what is going on here before I do.
_________________
OS: Gentoo 6.7.3-gentoo-dist, ~amd64, 17.1/desktop/plasma/systemd/merged-usr
MB: MSI Z370-A PRO
CPU: Intel Core i9-9900KS
GPU: Intel Arc A770 16GB & Intel UHD Graphics 630
SSD: Samsung 970 EVO Plus 2 TB
RAM: Crucial Ballistix 32GB DDR4-2400
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9677
Location: almost Mile High in the USA

PostPosted: Sat Feb 10, 2018 9:07 pm    Post subject: Reply with quote

These rough estimates are making things round the wrong way. So, not enough accurate data here to tell. You can see your firefox is using a tremendous amount of memory that changes, so you need to take that into account. It''s got 1.9GB allocated in physical memory by itself.

Also you're starting with 15G (what's your free without -h say?) due to the kernel using RAM for page tables, video memory if you don't have dedicated video memory, and unusable due to hardware issues.
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
AndrewAmmerlaan
Developer
Developer


Joined: 25 Jun 2014
Posts: 262
Location: Nijmegen

PostPosted: Sun Feb 11, 2018 8:34 am    Post subject: Reply with quote

I rounded everything up intentionally, so that the end result would be rounded up as well. Firefox does indeed use a lot of ram, but this is what free shows without java running:
Code:

andrew@Andrew-Gentoo ~ $ free
              total        used        free      shared  buff/cache   available
Mem:       16345300     3246124    10865148       33872     2234028    14080736
Swap:       7488508           0     7488508

It will fluctuate between 2 and 3, mostly due to firefox, and in my original post I used 4GB as an estimate, so I would say that that is rounded the right way. Wouldn't it make sense for the ram usage with java running to be just this 'at rest' value + the memory that java uses + additional cache? Because that is not what seems to happen.

Regarding video memory: I have 2GB of vram, and 1GB of GTT memory. But if I understand correctly what you're saying, the vram will overflow into ram if it's full? That would certainly explain part of the additional ram usage.
_________________
OS: Gentoo 6.7.3-gentoo-dist, ~amd64, 17.1/desktop/plasma/systemd/merged-usr
MB: MSI Z370-A PRO
CPU: Intel Core i9-9900KS
GPU: Intel Arc A770 16GB & Intel UHD Graphics 630
SSD: Samsung 970 EVO Plus 2 TB
RAM: Crucial Ballistix 32GB DDR4-2400
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum