On Sat, Mar 18, 2017 at 07:15:29PM +0100, David Lowe wrote: > On 2017-03-18 09:28, Otto Moerbeek wrote: > > On Fri, Mar 17, 2017 at 01:04:29PM +0200, Mihai Popescu wrote: > > > > > Hello, > > > > > > I am using top to show running programs activity on an OpenBSD system. > > > > > > Is there another better command to show in detail the memory used by > > > programs? > > > > > > My system has 8GB physical RAM. Looking at this, can someone tell me > > > if OpenBSD uses the "swap memory" model used by other OSes, basically > > > moving chunks from physical memory to the swap partition when they are > > > not used? > > > > Pages in physical memory are paged out to swap space, if thery are not > > actively used *and* there is general shortage of physical memory. If > > physical memory is not tight, no swapping will occur. > > > > > > > > If a program ask for a memory allocation, is this request satisfied > > > imediately if there is enough physical RAM available or is it done at > > > the moment the program needs to do read/write on that memory? > > > > Virtual memory is allocated subject to per process ulimits and general > > platform limitation but not touched on allocation. Only when the > > virtual pages are referred to they will become backed by physical > > pages. These pages might be paged out to swap if need be. > > > > > > > > Expanding the first question, is there a command to show all these > > > details, like total memory used, static and dynamic, how much is > > > physical or swap, etc? > > > > top shows two columns: SIZE and RES. SIZE is the total virtual memory > > used by a process (executable, stack and data). RES are the total > > physical pages in use by a process. Both columns can be deceptive > > since e.g. memory can be shared by multiple processes. There are also > > things like dynamically loaded libraries that complicate matters. > > > > procmap can show a lot of details about a process, but that's maybe > > too much for your purpose. It also is disabled in a default setup. > > > > but: > > > > $ ps -axO tsiz,dsiz,ssiz,vsz,rss,maxrss,%mem,lim > > > > Will show you most of the details you're after. See the man page for > > some explanation. > > > > Note: the SIZE and RES columns from top are called vsz and rss in ps, > > text is the name fthe executable program code. > > Thanks for the explanation! > May I ask why I am getting RES > SIZE sometimes? > > Here is one line as example: > 5411 d.lowe 2 0 12M 16M sleep/2 kqread 5:32 0.00% tmux
My guess would be shared libs, -Otto