Carlos E. R. wrote:
I thought about it, but I don't really know what happens; I have noticed similar numbers in mine. I have a guess: that "VIRT" shows the assigned or memory, but maybe it has holes, or it hasn't been "located". Poor choice of words... I don't think I can express my idea well tonight.
I had some suspicions along those lines myself - if a daemon does a malloc(100M), it's VIRT size would presumably shoot up to 100M, but until all of that 100M has been initialised, none of it will be resident, nor will it be swapped out.
I got another idea; I don't know if Linux does this, but I remember Windows did, and perhaps still does. Windows can completely discard unused code sections of programs and libraries; I don't mean swaping memory out, but discard. If that part of the code is needed again, it is reloaded from the original executable file. This way, it needs less swap file space.
Read-only pages - I'm sure Linux can do this too.
Can Linux do a similar thing? Using swap space would be faster (when reading back), I think, but if it does it could also help explain the discrepancy you found in top.
Well, that's a lot of code - 20M or so. I suppose with libraries it's possible. /Per Jessen, Zürich