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

Re: Tracking down memory leaks



On 2015-10-13 at 10:26, Marc Shapiro wrote:

> Is there a way to determine what is using up my memory?  I have an
> 8GB system and every few days the memory usage rises to over 7 GB and
> up to a GB, or more of swap is used.  Granted, I have 3 X sessions
> running, along with 2 instances of Firefox and one of Chrome, not to
> mention up to 3 instances of Libre Office, but... When I first added
> the 8 GB (I used to do this on 2.25 GB!) I could run for months
> without having a memory problem.  Now it's every few days.
> 
> When this happens, I exit all programs and shut down all three X 
> sessions.  I also log out the other two users.  This leaves me with
> only a single login and nothing but bash running.  When I run 'free'
> it usually shows over 2 GB in use!  When I reboot, the memory usage
> is back down at about 250 MB.  Much more reasonable.
> 
> So how do I tell what is using up the memory and not freeing it up?

My usual first stop is top. Launch it, then press 'M' (capitalized) to
sort by memory usage; that will tell you what process(es) is(/are) using
up the largest share(s) of the RAM.

What the next steps are depends on what those processes are. In my case,
with the last significant memory leak I found, the process was X, and
further digging revealed that the X heap size was growing without limit;
it turned out to be a problem with fglrx, and went away when I switched
to the radeon drivers.

In your case, since it apparently happens without X running, the only
candidates I can think of are background (daemon-like) processes or the
kernel itself.

> Is there a way to free that memory without having to reboot?

Depends what process(es) is/are using it.

If it's a background daemon, restart that daemon.

If it's the kernel, probably not, but it would be worth reporting the
problem as a bug against the kernel.

-- 
   The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man.         -- George Bernard Shaw

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: