[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: about `out of memory`



On Fri, Nov 01, 2019 at 10:10:55AM +0000, Nagisa Weaton wrote:
> 
> Hello everyone, sorry for bothering all of you, but I need some advice.

[...]

> My work (I’m a Java developer) is the same as when I worked on Windows installed on my laptop, both of the PC and laptop have 16G memory.

As a start, you might want to have a look at your processes and
their memory usage: perhaps you can spot one which is particularly
memory-hungry.

Open a console, invoke "top" and then hit "m" to sort by memory
usage.

There are three memory usage columns in the top display (VIRT, RES,
SHR). The short version is that you care mainly about RES, the
"resident size". You can get a first impression about the long
version e.g. here [1] -- the very well written man page has many
more details. If you prefer to read it in the browser, here [2]
is a good reference; that said, reaching for the man page in
a terminal is usually a good reflex to acquire.

There are many things this advice doesn't cover. The used memory
might not be attributable to a single (group of) processes. The
kernel might be eating the memory. Yadda, yadda. But it's a start.

FWIW, here's an extract of my first few top lines:

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                                                                    
 2828 tomas     20   0 2090668 308348 140592 S   0.0   1.9   0:26.22 firefox-esr                                                                                                                                
 4182 tomas     20   0 1473828 162392 119748 S   1.0   1.0   0:01.26 Web Content                                                                                                                                
 2872 tomas     20   0 1456488 131928  95712 S   0.0   0.8   0:03.34 Web Content                                                                                                                                
 2948 tomas     20   0 1441944 131032  90908 S   0.0   0.8   0:01.54 Web Content                                                                                                                                
 4216 tomas     20   0 1402104  88976  64880 S   0.0   0.6   0:00.17 Web Content                                                                                                                                
 1663 root      20   0  328260  60752  42156 S   3.3   0.4   0:13.90 Xorg                                                                                                                                       
 2661 tomas     20   0  225316  52268  27272 S   0.7   0.3   0:00.86 emacs                                                                                                                                      
 1981 postgres  20   0  209344  25884  24020 S   0.0   0.2   0:00.05 postgres                                                                                                                                   
 2431 tomas     20   0   47684  14932   9580 S   0.0   0.1   0:00.70 xterm                                                                                                                                      
 3875 tomas     20   0   47480  14764   9668 S   0.0   0.1   0:00.23 xterm                                                                                                                                      
 2411 tomas     20   0   46128  13400   9596 S   0.0   0.1   0:00.06 xterm                                                                                                                                      

You can see that firefox is here (by far!) the fattest guy, with
300M (the display shows usage in KB). Those "Web Content" thingies
are also Firefox in disguise, so it's really like 650M or so. Next
are X, emacs and Postgres.

Cheers

[1] https://serverfault.com/questions/138427/what-does-virtual-memory-size-in-top-mean
[2] http://man7.org/linux/man-pages/man1/top.1.html

-- tomás

Attachment: signature.asc
Description: Digital signature


Reply to: