r/openbsd Help understanding memory usage stats

posted by u/elwha1 on 07 Dec 2020

Hi folks - I'm looking for some help understanding the memory usage stats outputted from top and htop on my machine, a ThinkPad T520 with 8GB of RAM running OpenBSD 6.8. I'm a newcomer to OpenBSD, so apologies if the answer should be obvious, but after reading the relevant man pages and searching this sub and Google, I haven't yet found an answer that's satisfied my curiosity.

At a high level, my question boils down to: How can I get an accurate sense of how much memory my system and applications are using? After migrating to OpenBSD from Linux, I had anticipated a pretty light memory footprint. But with nothing but fvwm, xterm and a couple small applications running, htop shows more than 800MB of memory being used. That doesn't seem right, especially looking at the memory consumed by each individual process. top shows two different memory stats, with one being quite low -- and more in line with what I would expect -- and the other being relatively high. But I'm not sure how to interpret the distinction between act and tot; it seems like this might come down to the difference between physical and virtual memory, though I'm not confident about that.

Screengrabs for comparison: https://imgur.com/a/h2nz5mH

Thanks in advance!

edit: Some screengrabs may be helpful, I realize. I'll add those soon.

edit2: Added screengrabs.

posted by u/w-a-t-t on 08 Dec 2020 3▲
posted by u/elwha1 on 08 Dec 2020 1▲

Thanks for sharing this thread - it was helpful. I think what I'm still trying to grok is what each of these stats actually represents (see questions in thread below).

posted by u/[deleted] on 08 Dec 2020 3▲

On FreeBSD and OpenBSD I always trust top over htop, or any other 3rd party stat or fetch utility. Top will always give you the accurate info.

posted by u/ngc-bg on 08 Dec 2020 2▲

It seems like htop is displaying tot - cache . Usually I am sticking to the base system tools if I need to be sure for these kind of measurements. Top and vmstat are quite precise I think.

posted by u/elwha1 on 08 Dec 2020 2▲

Aha! Yes, the arithmetic seems to work out. But what does tot reflect, as opposed to act? My best guess is "total" and "actual," but that's not terribly illuminating.

posted by u/kmos-ports on 08 Dec 2020 2▲

"total" and "active"

posted by u/elwha1 on 08 Dec 2020 1▲

Thanks! And the distinction here is memory being used by active processes only (act) vs active plus sleeping/idle/etc (tot)? Or does act encompass memory used by all processes, while tot is inclusive of memory that has been cached but could be freed? I came across this post describing Inactive memory in FreeBSD's top. Is tot basically the same as Active + Inactive, using those definitions?