Linux – Virtual memory on Linux doesn’t add up

linuxmemoryvirtual-memory

I was looking at System Monitor on Linux and noticed that Firefox is using 441 MB of memory, and several other applications are using 274, 257, 232, etc (adding up to over 3 GB of virtual memory). So I switch over to the Resources tab, and it says I'm using 462 MB of memory and not touching swap. I'm confused. What does the virtual memory amount mean then if the programs aren't actually using it. I was thinking maybe memory they've requested but aren't using, but how would the OS know that? I can't think of any "I might need this much memory in the future" function..

Best Answer

  • First off, shared memory is not really (?) counted correctly by top. Second, yes, a program asks for rights to memory, and then uses it, but it may never touch any, and the OS knows that. No problem at all for every app to have allocated all the ram and swap, as long as they don't try to use it :-D > We are not in a Mac OS Classic world (in fact, that is how the old Ram Doubler worked, letting you use the difference between allocated and used).