LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   linux is eating up my memory (https://www.linuxquestions.org/questions/linux-newbie-8/linux-is-eating-up-my-memory-4175521513/)

subratkprusty 10-09-2014 12:45 AM

linux is eating up my memory
 
2 Attachment(s)
Hi, I am unable to trace which process is consuming my memory.
In free -m command I can see 6 GB Used memory but in actual no such process is running to take that much memory. Even Top command shows used memory with out such process.Please help....

pan64 10-09-2014 01:11 AM

have you checked this: http://www.linuxatemyram.com/ ?

EDDY1 10-09-2014 01:17 AM

Quote:

Originally Posted by pan64 (Post 5251191)
have you checked this: http://www.linuxatemyram.com/ ?

Great info if I read it right

grover 10-09-2014 09:15 AM

Quote:

Originally Posted by pan64 (Post 5251191)
have you checked this: http://www.linuxatemyram.com/ ?

The "free" output shows that his memory is actually used.
So it's not just the old caching of filesystem and data thing.

If the "top" output is actually sorted by memory usage, there is nothing using the memory.
Looks strange really.

Is this a virtual machine?

suicidaleggroll 10-09-2014 10:07 AM

It looks to me like top is sorted by processor usage (the default). When you open top, press "M", and it will re-sort the list by memory usage.

haertig 10-09-2014 10:35 AM

Why do you think something is using up all your memory?

Based on your comments, I suspect you may have recently come to Linux from the Windows world. These two operating systems handle memory differently. When Windows doesn't have something specific to do with memory, it shows up as free. However, linux tries to use all the memory it has. If a process doesn't need it, the OS will use it for system level stuff - like buffers and cache - to speed up overall operation of the system. But if a process needs the memory, Linux will immediately free it up for that use.

Windows displays excess memory as free, kind of like a badge of honor for its efficiency (ha!) Linux just goes about its way and uses that excess memory. In your case, you seem to have a goodly amount of memory, and even Linux can't find anything much to do with it. So you have about 5Gb showing as free. Having 6Gb in use does not represent "something using up your memory". Pretty much you're experiencing just the opposite ... you have more memory than Linux can figure out what to do with at this time.

grover 10-09-2014 11:12 AM

Quote:

Originally Posted by haertig (Post 5251397)
If a process doesn't need it, the OS will use it for system level stuff - like buffers and cache - to speed up overall operation of the system.

Yes, that's usually the case. But have a look at the "free" output supplied.
buffers and cache is nearly nothing. It's all actually used.
So he should really be interested what is using his memory.

haertig 10-09-2014 12:06 PM

Try:
Code:

ps auxww --sort=-%mem
The above will put the biggest users at the top of the output. You will have to scroll back up to see them or send your output to pg, more, or head, etc.

Post the output of your system from the above command (put it inside [code] tags for readability).

For example, here's the first few lines of output from my system:
Code:

ps auxww --sort=-%mem | pg
USER      PID %CPU %MEM    VSZ  RSS TTY      STAT START  TIME COMMAND
user1    11218  9.4 10.9 1180784 387412 ?      Sl  09:15  10:26 /usr/lib/firefox/firefox
root      1434 34.0  4.3 272808 154580 tty8    Ss+  Sep18 10313:46 /usr/bin/X :0 -audit 0 -auth /var/lib/mdm/:0.Xauth -nolisten tcp vt8
plex    24082  0.2  1.5 1806932 55692 ?      SNl  Oct08  2:33 Plex Plug-in [com.plexapp.system] /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/bootstrap.py --server-version 0.9.9.14.531-7eef8c6 /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/System.bundle
user1    1792  0.0  0.9 283748 33680 ?        S    Sep18  0:09 /usr/lib/xfce4-places-plugin/xfce4/panel-plugins/xfce4-places-plugin  2 12582965 places Places Access folders, documents, and removable media
plex    27333  0.0  0.9 1951508 33656 ?      S<l  Sep19  8:16 ./Plex Media Server
user1    6066  0.0  0.8 617940 30912 ?        Sl  Sep29  0:02 /usr/bin/python /usr/share/system-config-printer/scp-dbus-service.py
root      3860  0.0  0.8 516516 30248 ?        Sl  Sep22  1:09 python /usr/lib/linuxmint/mintUpdate/mintUpdate.py show
...


haertig 10-09-2014 12:11 PM

Quote:

Originally Posted by grover (Post 5251413)
Yes, that's usually the case. But have a look at the "free" output supplied.
buffers and cache is nearly nothing. It's all actually used.
So he should really be interested what is using his memory.

Point taken. I made a generic statement and should have looked at the specifics of his free output. My error.

However, with almost half of his systems memory showing as free, his system is running fine. It would be interesting to see what his biggest memory user processes are, but at this time, they are not negatively affecting his system.

jlinkels 10-09-2014 01:19 PM

If you use top to show your memory usage, press shift-M to sort the processes according to memory usage. By default top sorts the display according to CPU time used. It is possible that very low CPU processes consume memory but are off-screen now.

In this case however I don't think you have a memory consumption problem.

jlinkels

grover 10-09-2014 01:56 PM

Quote:

Originally Posted by haertig (Post 5251435)
However, with almost half of his systems memory showing as free, his system is running fine. It would be interesting to see what his biggest memory user processes are, but at this time, they are not negatively affecting his system.

Well, yes and no. I think as this user has got 5 GB of free memory, he doesn't have a problem of running out of memory.
But ... that's a pretty unusual situation, that he is in.

Almost nothing is cached or in the buffers? Still we have 6 GB used up?
So the majority of data that he for example used during booting or during the work he might have done until that point is still in the use?

That's unusual. I would call this a pathological state of the system. There may be a sensible explanation for it, but I haven't had it with all the system I'm running.

What kind of processes would swallow 6 GB of memory and never give anything back so the kernel can cache it until it's reused?
If I were to run this system, I would be _very_ curious about what's going on.

haertig 10-09-2014 01:59 PM

Maybe he has some process, low in CPU usage so not showing up markedly in top, that still holds memory? Like a virtual machine running, but pretty much idle?

grover 10-09-2014 02:23 PM

Might be the case.
But still he has only 69M in the cache?

I had a quick look at my system after a simple boot (desktop of course, but may still be comparable).
After boot I have 97M cached. If I start doing anything it immediately goes up, up to 315M in the first 2 minutes and after 15 minutes its at 500M. That's the data been used and not completely freed because it may be used again - of course you know this.

Surprinsingly he has only 69M after 17 mins uptime. Strange!

astrogeek 10-09-2014 02:35 PM

Yes, the cache does look a little strange.

Since the OP has not returned, ahem..., it would be interesting to know if they are running a custom kernel, have tweaked the kernel cache parameters, what is actually running on that machine, distro...

We actually know almost nothing about it other than the screenshots.

subratkprusty 10-13-2014 08:48 AM

Thanks all for your helping hand...
I found some kernel entries which was making these values default.


# added to set file max
fs.file-max = 762368

# added to set vm.nr_hugepages = 3072 at boot time
vm.nr_hugepages = 3072

# Added huge page group
vm.huge_tlb_shm_group = 501


After commenting out these parameters & reloading the parameters Memory usage show normal...


[pts/9][19:16:42:root@XXXXXXXX] ~>free -m
total used free shared buffers cached
Mem: 11913 4700 7212 0 2 131
-/+ buffers/cache: 4566 7346
Swap: 6023 0 6023


Extremely sorry for the delayed reply.
Thanks you all again...


All times are GMT -5. The time now is 09:29 AM.