Ask Your Question

"free" and Memory leaks?

asked 2017-11-13 15:54:18 -0600

toddandmargo gravatar image

Is there a way to use "free" or similar to notify you when memory leaks are about overwhelm your system?

I can create a cron job and eMail myself if it is time to reboot, but I do not know what to look for in "free".

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-11-14 01:15:00 -0600

masteroman gravatar image

Please be mindful that "Free" is simply unallocated memory, not necessarily all of the free/available memory you have.

People often link to the following website which explains RAM usage under Linux. It is worth taking a look in order to better understand memory management. There's more to the story, but basic stuff is simply noted there.

As for the original issue, you would better be finding the exact issue (memory leak). Pin point the application that is causing it and troubleshoot further from there. I usually use atop to periodically log resource usage, and if something goes wrong, atop usually catches the potential suspect if run often enough.

Once you find the responsible application you can either try resolving the issue within it, report the bug to the upstream or simply tweak the OOM (Out-Of-Memory) killer to kill that application first.

Having swap on the system could potentially help you in avoiding the crash and buy you some time if you notice the issue while it is happening.

edit flag offensive delete link more


From the link you gave me:

When should I start to worry?

A healthy Linux system with more than enough memory will, after running for a while, show the following expected and harmless behaviour:

    free memory is close to 0
    used memory is close to total
    available memory (or "free + buffers/cache") has enough room (let's say, 20%+ of total)

At the current time, I haven't anything other than wild speculations as to what the issue is. "atop" looks sweet.

Thank you!

toddandmargo gravatar imagetoddandmargo ( 2017-11-14 03:26:57 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-11-13 15:54:18 -0600

Seen: 146 times

Last updated: Nov 14 '17