LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Where is my memory :( (https://www.linuxquestions.org/questions/linux-hardware-18/where-is-my-memory-809075/)

alaios 05-20-2010 08:29 AM

Where is my memory :(
 
Hello I am running a linux maching on a PC which has 2 GB of RAM Installed.

I run out of memory most of the time so I try to understand where memory goes.

Code:

caracus:/home/apa # free -m
            total      used      free    shared    buffers    cached
Mem:          1914      1839        74          0          8        319
-/+ buffers/cache:      1511        402
Swap:        2062      1955        107


Code:

top - 15:28:52 up 3 days,  7:22,  9 users,  load average: 4.73, 5.60, 6.36
Tasks: 230 total,  4 running, 225 sleeping,  0 stopped,  1 zombie
Cpu(s): 26.5%us, 69.4%sy,  0.0%ni,  4.1%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  1959936k total,  1885700k used,    74236k free,    9392k buffers
Swap:  2112508k total,  1999344k used,  113164k free,  338672k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 1428 root      20  0 1684m 467m 2872 S    2 24.4  73:19.45 Xorg
18537 apa      20  0  883m 281m  35m S    8 14.7  45:02.24 firefox
 3233 apa      20  0  876m  62m  13m S    0  3.3  4:08.47 thunderbird-bin
32635 apa      20  0  207m  57m  15m S    7  3.0  0:18.99 npviewer.bin
19068 apa      20  0  926m  55m 3508 S    0  2.9  0:23.85 MATLAB
32713 apa      20  0  782m  54m  13m S    0  2.9  0:04.60 java
 3398 apa      20  0  671m  51m 4532 S    0  2.7  0:53.15 konqueror
 3052 apa      20  0  604m  35m  10m S    0  1.8  3:10.46 plasma-desktop

Could you please help me try understand the stats above?
Perhaps then I could be able to blame something that consumes my memory.

Best REgards
Alex

AlucardZero 05-20-2010 08:54 AM

well.. Xorg and Firefox. Make sure your system is all up to date and restart X, and watch it.

Also, if you don't know, http://www.linuxatemyram.com/

alaios 05-20-2010 09:44 AM

Thanks for the web site :)

H_TeXMeX_H 05-20-2010 10:32 AM

That's a good site, I will link to it, because a lot of people ask this question.

AlucardZero 05-20-2010 10:33 AM

However I do think you have a problem since you're using almost 2GB of swap. Run vmstat 10 and watch the 'so' and 'si' columns - if there are a lot above 0 then you're actively swapping and you definitely have a problem.

johnsfine 05-20-2010 10:43 AM

I did a google search for +xorg +"memory leak" and of course there are a ton of hits and I don't know how to evaluate which are relevant. The one that looked most relevant was

http://forums.opensuse.org/get-help-...os-11-0-a.html

Quote:

Originally Posted by alaios (Post 3975455)
Hello I am running a linux maching on a PC which has 2 GB of RAM Installed.

It would take a lot more investigation to find out whether something is really wrong (such as a memory leak) or whether you just are using more memory than you have.

Those stats seem to indicate MATLAB, java, konqueror, plasma-desktop and maybe others are tying down a lot of memory while relatively idle. The swap partition is nearly full, so the kernel is forced to leave anonymous pages of idle tasks in physical ram while either dropping pages of active .so's or even calling the "out of memory killer".

So if those stats indicate all valid use of memory (not leaks) then you need a larger swap partition. Even with that, you would have terrible performance each time you switch to a previously idled task and even worse if too many of those tasks are trying to be active at once. You might also need more physical ram.

If it is a memory leak, the most likely problem is Xorg. But I don't have good advice on how to figure out whether there is a memory leak in Xorg.

Quote:

Originally Posted by H_TeXMeX_H (Post 3975580)
That's a good site, I will link to it, because a lot of people ask this question.

It's a great site, because lots of people ask the question answered by that site. But this time it is a distraction. This thread is not the usual "linux ate my ram" question at all. This time, something definitely is using too much anonymous memory for healthy operation with just 2GB of ram plus 2GB of swap.

So the answer is not the usual "everything is OK, you just misunderstood the stats". The answer is one of:
1) There is a memory leak that should be found and fixed.
2) You need more swap space
3) You need both more swap space and more physical ram.

H_TeXMeX_H 05-20-2010 11:44 AM

To find out if Xorg is leaking, leave it on alone (close firefox and the rest) for a while and check top once in a while to see if RAM usage goes up. If it keeps going up, it is a leak.

I don't see any reason to suspect a leak in Xorg, it could be just a lot of memory intensive processes running, close them all and see if it reduces back to normal.

fruttenboel 05-20-2010 12:03 PM

Quote:

Originally Posted by alaios (Post 3975455)
Hello I am running a linux maching on a PC which has 2 GB of RAM Installed.

I run out of memory most of the time so I try to understand where memory goes.

Code:

top - 15:28:52 up 3 days,  7:22,  9 users,  load average: 4.73, 5.60, 6.36
Tasks: 230 total,  4 running, 225 sleeping,  0 stopped,  1 zombie
Cpu(s): 26.5%us, 69.4%sy,  0.0%ni,  4.1%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  1959936k total,  1885700k used,    74236k free,    9392k buffers
Swap:  2112508k total,  1999344k used,  113164k free,  338672k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 1428 root      20  0 1684m 467m 2872 S    2 24.4  73:19.45 Xorg
18537 apa      20  0  883m 281m  35m S    8 14.7  45:02.24 firefox

Could you please help me try understand the stats above?
Perhaps then I could be able to blame something that consumes my memory.

Best REgards
Alex

My XORG only eats away 12 % of half a gigabyte.... I run a 1280x1024 screen in 24 bit colour. Semonkey eats 17%.

Code:

2850 root      20  0 73280  58m 3720 S    2 12.5  1:09.60 X
 2916 jan      20  0 77636  21m 7744 S    0  4.5  0:09.58 artsd
 3076 jan      20  0  198m  79m  23m S    0 17.2  0:34.79 seamonkey-bin

Code:

jan@Beryllium:~$ cat /proc/meminfo
MemTotal:      476712 kB
MemFree:          9300 kB
Buffers:        78608 kB
Cached:        156648 kB
SwapCached:          0 kB
Active:        246548 kB
Inactive:      179076 kB
HighTotal:          0 kB
HighFree:            0 kB
LowTotal:      476712 kB
LowFree:          9300 kB
SwapTotal:    1124436 kB
SwapFree:      1124432 kB
Dirty:            216 kB
Writeback:          0 kB
AnonPages:      190392 kB
Mapped:          69640 kB
Slab:            18528 kB
SReclaimable:    11376 kB
SUnreclaim:      7152 kB
PageTables:      1864 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
WritebackTmp:        0 kB
CommitLimit:  1362792 kB
Committed_AS:  439000 kB
VmallocTotal:  540664 kB
VmallocUsed:    12984 kB
VmallocChunk:  527400 kB
DirectMap4k:    15616 kB
DirectMap4M:    475136 kB


johnsfine 05-20-2010 12:46 PM

Quote:

Originally Posted by H_TeXMeX_H (Post 3975639)
To find out if Xorg is leaking, leave it on alone (close firefox and the rest) for a while and check top once in a while to see if RAM usage goes up. If it keeps going up, it is a leak.

That would be wasted effort. A leak in Xorg would mean it leaks memory when some specific kind of activity occurs (of course we start with no clue what specific kind of activity). So if you test it with no activity and nothing leaks, you proved nothing. Anyway without a better measure of "RAM usage" you wouldn't know how to interpret the results even if you had some of whatever activity makes Xorg leak.

Quote:

I don't see any reason to suspect a leak in Xorg
So xorg's VIRT size of 1684m and RES size of 467m don't make you suspect a leak? What do you think caused that?

I don't know enough about Xorg. I don't know enough about all the other idle windows in the OP's system (that weren't mentioned in top). So I'm not trying to say those values indicate a leak, just that they make one suspect a leak.

H_TeXMeX_H 05-20-2010 01:10 PM

Memory leaks are hard to diagnose and hard to fix, so if you know a better way, say so. Otherwise, I would close all processes except for Xorg and see if the usage goes down, if it does, then it was just those processes. You can also try using a program that you know doesn't leak but uses Xorg.

When I was running Xfce I had exactly that happen, and no matter what I did the RAM usage went up with time (characteristic of a leak). It didn't matter if I left it alone or did something, the leak was still there.

salasi 05-20-2010 03:56 PM

Quote:

Originally Posted by alaios (Post 3975455)
Hello I am running a linux maching on a PC which has 2 GB of RAM Installed.

I run out of memory most of the time so I try to understand where memory goes.

Code:

caracus:/home/apa # free -m
            total      used      free    shared    buffers    cached
Mem:          1914      1839        74          0          8        319
-/+ buffers/cache:      1511        402
Swap:        2062      1955        107


Code:

top - 15:28:52 up 3 days,  7:22,  9 users,  load average: 4.73, 5.60, 6.36
Tasks: 230 total,  4 running, 225 sleeping,  0 stopped,  1 zombie
Cpu(s): 26.5%us, 69.4%sy,  0.0%ni,  4.1%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  1959936k total,  1885700k used,    74236k free,    9392k buffers
Swap:  2112508k total,  1999344k used,  113164k free,  338672k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 1428 root      20  0 1684m 467m 2872 S    2 24.4  73:19.45 Xorg
18537 apa      20  0  883m 281m  35m S    8 14.7  45:02.24 firefox
 3233 apa      20  0  876m  62m  13m S    0  3.3  4:08.47 thunderbird-bin
32635 apa      20  0  207m  57m  15m S    7  3.0  0:18.99 npviewer.bin
19068 apa      20  0  926m  55m 3508 S    0  2.9  0:23.85 MATLAB
32713 apa      20  0  782m  54m  13m S    0  2.9  0:04.60 java
 3398 apa      20  0  671m  51m 4532 S    0  2.7  0:53.15 konqueror
 3052 apa      20  0  604m  35m  10m S    0  1.8  3:10.46 plasma-desktop

Could you please help me try understand the stats above?
Perhaps then I could be able to blame something that consumes my memory.

Best REgards
Alex

<attitude>
You are running some version of KDE 4? Well, that'll probably be the problem then.
</attitude>
Looking at your numbers, there are several noteworthy features:
  • you have a zombie process; that is doing you no good, but it is probably not doing you appreciable harm.
  • your load average numbers are on the high side; this probably means that your computer is running slowly and is somewhat unresponsive; is this the basic problem, or are you propelled by the intellectual satisfaction of understanding this problem?
  • the big consumers of memory appear to be Xorg and FF; the other stuff that you can see is mostly 'small change'
  • for ff, that level of memory consumption is probably reasonable if you lots of tabs open, if you only have one or two it isn't
  • Xorgs' high level of consumption could be a 'bug' in Xorg itself, or, more likely, something is asking Xorg for services that legitimately cause Xorg to consume lots of memory; my bet is that the latter, is probably more likely and is the only thing that you could do something about easily
  • does this happen soon after a clean boot, or is it only after the PC has been running without a re-boot/logout for a while?

You are probably running the version of KDE that came with SUSE out of the box; if so, ensure that you do not have random repositories enabled and try an upgrade to factory if you dare. If you have any conflicting repos enabled currently, sort that problem out and see where that gets you.
(Hmm, that last link seems to be a thread started by someone called, on that forum, alaios; that repo list looks a bit longer than desirable, but with nothing crazy in it - not the full 'I've used one click install a lot' madness).

Alternatively, try a different GUI; do you still have the same problem?


All times are GMT -5. The time now is 11:37 PM.