Score:0

What does lower case "g" mean in top output?

cg flag

Can someone please help explain this, I have always used to interprete the "g" in top output to be size in Gigabytes even though the convention is to use uppercase "G" but now I am having second thoughts.

I was monitoring my system memory usage when I found chrome using up to 1132.9g under VIRT column - an imposible amount of memory for the resources I have in my computer.

How can this be possible?

enter image description here

Romeo Ninov avatar
in flag
Does this answer your question? [How is memory usage reported in Linux?](https://serverfault.com/questions/48582/how-is-memory-usage-reported-in-linux)
Score:2
fr flag

I have always used to interprete the "g" in top output to be size in Gigabytes even though the convention is to use uppercase "G" but now I am having second thoughts.

It's gigabytes. The procps-ng developers expect the user to choose between upper- and lower-case at compile time. Really.

I was monitoring my system memory usage when I found chrome using up to 1132.9g under VIRT column - an imposible amount of memory for the resources I have in my computer.

VIRT has no relationship with the resources you have in your computer. (Hence the name "virtual".) It represents virtual memory address space, and each region of virtual address space may be backed by actual RAM, but it may also be backed by something else – such as memory-mapped files, or nothing at all (a "fresh" RAM-backed anonymous mapping is not all reserved upfront; it only begins consuming RAM as it's dirtied).

In the case of web browsers, Chrome in particular, massive empty mappings may be used for JavaScript hardening similar to WebKit's GigaCage which Chrome also implements. As long as the mapping stays mostly untouched, it also mostly doesn't occupy any RAM – aside from a few kB or MB for the page table entries. (VSCode counts as a "web browser" here, as its Electron runtime is literally Chrome, and even "ng serve" – i.e. Node.js – uses the same JavaScript "V8" engine as Chrome does.) Finally for the GNOME Shell process, I suspect it's something to do with GPU VRAM access, although I'm not quite sure.

tl;dr you are looking at the wrong column. Just because it happens to count megabytes doesn't mean it's system memory usage.

AguThadeus avatar
cg flag
It's starting to make sense now. I was under the wrong assumption that VIRT is the combination of RAM + whatever has been swapped
user1686 avatar
fr flag
I _think_ the RES column (resident) is "combination of RAM + swap", but I could be wrong. Try the [swapusage](https://raw.githubusercontent.com/grawity/code/0917ca8406c74df87986b1a057cff049e58d1411/system/swapusage) script. (Recent htop versions finally have a M_SWAP column that can be added via settings, that's supposed to show how much of the process has been swapped, but it doesn't seem to be accurate and does not match /proc/*/VmSwap at all...)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.