Solved Question: RAM "leakage" ?

D

Deleted member 43773

Guest
Hi all.

For a couple of days I am trying to understand something.
I observe my RAM is nearly used up - or at least system info tools tell me so.

A typical view of top looks like this:

Code:
last pid:  6667;  load averages:  0.32,  1.18,  1.22                                          up 0+00:37:36  07:14:28
50 processes:  1 running, 48 sleeping, 1 zombie
CPU:  2.0% user,  0.0% nice,  9.8% system,  0.6% interrupt, 87.6% idle
Mem: 1058M Active, 486M Inact, 59M Laundry, 5973M Wired, 6913K Buf, 317M Free
ARC: 4899M Total, 2810M MFU, 2026M MRU, 800K Anon, 40M Header, 22M Other
     4580M Compressed, 8763M Uncompressed, 1.91:1 Ratio
Swap: 4096M Total, 4096M Free

  PID USERNAME    THR PRI NICE   SIZE    RES STATE    C   TIME    WCPU COMMAND
47203 myuser       51  21    0  2807M   493M select   3   1:43   5.37% firefox
59782 myuser       26  21    0  2568M   312M select   1   2:08   3.36% firefox
25581 myuser        3  21    0  6284M    81M select   1   0:39   2.90% Xorg
32327 myuser       10  52    0   254M    82M sigwai   1   0:15   0.79% vlc
45415 root          1  20    0    11M  1864K select   2   0:02   0.60% moused
59175 myuser       25  20    0  2618M   354M select   0   0:17   0.06% firefox
64408 myuser       24  20    0  2433M   192M select   0   0:09   0.05% firefox
6667 root          1  20    0    13M  3124K CPU3     3   0:00   0.04% top
27759 myuser        1  20    0    23M    11M select   1   0:00   0.03% fvwm
46783 root          1  20    0    10M  1020K select   3   0:01   0.02% devd
39906 myuser        1  20    0    22M    11M select   1   0:00   0.02% xterm
...

I find it astonishing, that Xorg is reported with over 6G.

Also vmstat confirms only 300M are free of 8G:
Code:
procs  memory       page                    disks     faults         cpu
r b w  avm   fre   flt  re  pi  po    fr   sr ad0 ad1   in    sy    cs us sy id
1 1 0  22G  307M   818   3   3   0  2388  419   0   0 6183  9442 19965  9  5 86

(I've seen values down to 253M)

This morning I made the following tests:
After boot I did not start X but stay in terminal only and again looked at top.
The memory reported as free first is well above 6G but then drops down, with approximately 200M per second.

So I also take a look at my little server, which has no X installed, which is up for over 26 days by now.
Looks similar:
Code:
CPU:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
Mem: 160K Active, 60M Inact, 30M Laundry, 15G Wired, 505M Free
ARC: 13G Total, 1465M MFU, 11G MRU, 3616K Anon, 79M Header, 487M Other
     11G Compressed, 12G Uncompressed, 1.07:1 Ratio
Swap: 32G Total, 100M Used, 32G Free

  PID USERNAME    THR PRI NICE   SIZE    RES STATE    C   TIME    WCPU COMMAND
30319 root          1  20    0    13M  3608K CPU3     3   0:00   0.05% top
...
...

So that gives me the clue:
X isn't the "offender" (if there is any).
There doesn't have to be problem, it may be normal.

Both machines run FreeBSD 12.2-RELEASE-p3 with ZFS, any pkgs are up to date, as far as I checked.
The first one with 8G RAM on 2 HDDs in mirror
The second with 16G on 4 HDDS in raidz2

So, here is my question:
May it be, there is no "Memory-leakage", but that's just a normal state of the system?
The RAM is not really used up, but only shown as, because it's managed by some kind of system's demon(s) (ZFS?),
but for the tools such as top or vmstat it looks like it's used up?

Or do I really have some kind of issue I shall engage?

Thanks.

P.S.: I also always have 1 zombie, even after reboot. So something has to be corrected anyway, even if both issues may have nothing to do with each other.
 
Check your "System Console", i.e. press the Alt+F1. Any unusual trail of errors?
My guess: one of your attached peripheral devices is malfunctioning, e.g. USB, etc.
 
May it be, there is no "Memory-leakage", but that's just a normal state of the system?
The RAM is not really used up, but only shown as, because it's managed by some kind of system's demon(s) (ZFS?),
but for the tools such as top or vmstat it looks like it's used up?
I'd say that's perfectly normal behaviour for a system running ZFS. As you can see in top, a fair amount of your memory is being used by ZFS as ARC cache to put it to some use rather than leaving it unused. Should the system come under memory pressure ZFS should release parts of the ARC, so there isn't really a problem here.
 
Almost certainly not a memory leak, otherwise expect your swap to be consumed as well. It's normal for RAM to be fully utilised, especially with zfs. I wouldn't worry unless you're seeing swap being used.

As to zombies, they can be tracked down, sort of. Use ps to find the process that's the zombie then look in the ppid column for its parent. If it's 1 then it's being caused at boot by init. Otherwise it's a daemon's spawn gone wild.
 
Thanks a lot, Guys.
Again I learned something.
Also the link to the FreeBSD ZFSTuningGuid is readable, thanks.

What I still don't understand is why top shows me about 6G (about 90% of usable RAM) for Xorg, if ZFS uses the most RAM.
Swap is used, varies up to 10% (app. 400M).
But I got that's something of understanding top, xorg, zfs, the system... but no issue.

However, the problem seems to be neither caused by ZFS nor Xorg.
I just checked:
When I start the system without X, top shows me ap 7G3 free - stays stable (I was wrong about this in my first post.)
When I start X, additionally 250..300M are used (normal), and although even top shows me the 6264M for Xorg, free RAM stays above 7G - no issues there.
Main suspects at the moment are firefox and thunderbird. But that will be offtopic. I first have to clean up and tidy by myself.

So, thanks for all the useful input guys.
 
Yes, well have a look at the resident size of firefox. 400MB here, 450MB there. It's a memory hog, always has been always will be when you have this massive javascript engine churning away in the background.
Basically web browsers should nowadays be considered another operating system running inside FreeBSD/systemd/Windows/Mac/Android etc.

Your query about SIZE of Xorg being 6G is rather more detailed than you might expect. Perhaps someone else can explain it better, but basically, this is the size of ALLOCATION of the application's text and data in the ELF format, as well as any stack requirements (depends on your system's defaults). It's not really memory used, but the size of the program, all its shared segments etc etc. What really should concern you is the RES output as this displays that which is actually in RAM, which in your case is 81MB.

Let's restore lynx to its rightful place in the www universe! ;):eek:
 
Thanks.

Yeah. Believe it or not. In times, when internet was only lynx or ftp the websites were best.
You actually received the information you were looking for quickly and directly without being forced to wait for the download of movies you immediately stop, because neither they contain any useful information nor you are interested in that boring crap, while you fill out "we-respect-your-privacy-but-you-need-to-agree-we-don't-care"-forms, thumbing through tons of stupid gassy, blank sellers gossip, wish someone finally invents a mouse with an engine driven scrollwheel, to faster scroll down those toilet-paper-pagedesigns,....- no, I am neither interested in an enscription of your bookclub, nor want any roses for my girlfriend, leave me alone with you newsletters that nobody actually reads anyway - no, I'm not interested in selling my car, so please stop sticking flyers behind my windshield wiper! - and I especially do not want further contact to anyone, until it's absolutely anavoidable, especially not with AI-chatbots (AI = Artificial Idiocy), nor with "satisfaction-polls" and particulary not with any customer support of any kind, because at some sudden point that makes me wish to bomb the company, and I want to stay a peaceful and reasonable civil citizen... until you finally get what the whole purpose of all this was:
"train departs 10:34 platform 3"
That was something you could get in 1994 with lynx over a 28.8k modem (analog telephone landline) in less than 90 seconds - without getting pi$$3#!
 
Addition:

I am watching my RAM-usage for quite a time now.
Everything seems to be OK.
One of the RAM-consumers is for quite sure my hand-knitted home-backup-script. When it stores away the 13GB of /home via tar the free RAM is significantly going low, but after it's done, RAM is been freed again.

Another point, the "longe term" small amount of free RAM - where my main suspicion originally came from - may be for sure the ZFS, which really may consume a lot of RAM to do its job.
When the machine runs for several hours without any disk-loads by root or users, my free RAM becomes app. 6GB again.

So anything seems to be quite nice.
 
Back
Top