# Full Swap? [solved]

## rahulthewall

Computer Run for 3 hours and swap says 1 GB of 1 GB full -> can anyone explain why?

----------

## alex.blackbit

a possible reason for that is a memory leak in some software.

use e.g. sys-process/htop and sort by memory usage to find out what's using a lot of software.

----------

## rahulthewall

Could it be due to the fact that I changed my memory model from flat to sparse?

----------

## alex.blackbit

i cannot definitely say: NO, but i think that's unlikely.

----------

## rahulthewall

 *alex.blackbit wrote:*   

> i cannot definitely say: NO, but i think that's unlikely.

 

Hmm, then I really do not know what it could be. I will have to look at it, right now I can not comprehend what the problem is.

----------

## Dairinin

2.6.28?

----------

## rahulthewall

 *Dairinin wrote:*   

> 2.6.28?

 

```

rahul@googly ~ $ uname -a

Linux googly 2.6.28-tuxonice-r4 #2 SMP PREEMPT Sat Mar 14 17:16:33 CET 2009 i686 Genuine Intel(R) CPU T2300 @ 1.66GHz GenuineIntel GNU/Linux

```

----------

## Dairinin

Same thing here. Since 2.6.28 upgrade page cache constantly forces app's pages to be swapped out during file write operation. I have 4Gig of physical memory and 1 Gig of swap space. Normally, as before 2.6.28, nearly 1 gig of ram is used by apps and daemons, and 3 gigs are for cache. Now, with 2.6.28, copying several gigs of data between partitions forces almost all of the app's memory into the swap. For now I've created a small 10M file for swap, which is filled right away, but due to it's small size the impact on the performance is negligible.

BTW, I saw one mentioning of this problem somewhere in lkml...

Ah, here it is http://lkml.org/lkml/2008/11/8/100

you can try a patch proposed in the last message.

----------

## shgadwa

I'm far from a Gentoo expert, but I should say that I was thinking of unmasking the 2.6.28 kernel and install it... Now I think I will just wait for it to become stable. Maybe (unless I'm wrong), for those x86 users (like myself), you should just go back to the stable kernel?

----------

## rahulthewall

 *belikeyeshua wrote:*   

> I'm far from a Gentoo expert, but I should say that I was thinking of unmasking the 2.6.28 kernel and install it... Now I think I will just wait for it to become stable. Maybe (unless I'm wrong), for those x86 users (like myself), you should just go back to the stable kernel?

 

Nah.., ACCEPT_KEYWORDS="~x86" is the way for me ..  :Smile: 

----------

## rahulthewall

 *Dairinin wrote:*   

> 
> 
> BTW, I saw one mentioning of this problem somewhere in lkml...
> 
> Ah, here it is http://lkml.org/lkml/2008/11/8/100
> ...

 

The patch does not make any difference. The funny thing is that if I restart the X server, the entire swap area is freed. So, there apparently is a memory leak in Xorg. This could be due to the fact that I am running Xorg-server-1.6 from the x11 overlay. So, basically I just have to restart my X server after every 3-4 hours right now, being careful not to forget it so that my computer does not freeze.  :Smile: 

This really needs a deep look into...

Maybe this is relevant somehow...

```

rahul@googly ~/Courses/Current/Guided Research $ dmesg | grep 915

intelfb: Framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G/915G/915GM/945G/945GM/945GME/965G/965GM chipsets

[drm] Initialized i915 1.6.0 20080730 on minor 0

[drm:i915_setparam] *ERROR* unknown parameter 4

[drm:i915_getparam] *ERROR* Unknown parameter 6

[drm:i915_getparam] *ERROR* Unknown parameter 6

[profile=][/profile]
```

----------

## rahulthewall

Annoying swap behaviour persists with 2.6.29-zen3 [and gentoo-sources-2.6.29-r1]. Unfortunately, this means that I have to restart X after every 4 hours and if I forget to do it, computer will just lock up at some point of time and I lose data and all that...

And then there is this interesting new warning in Xorg.0.log

```

(WW) intel(0): libpciaccess reported 0 rom size, guessing 64kB

```

```

x11-drivers/xf86-video-intel-2.6.99.902

x11-base/xorg-server-1.6.0

```

```

googly rahul # uname -a

Linux googly 2.6.29-zen3-08318-g1e28aa5 #4 SMP PREEMPT Sat Apr 11 09:31:53 CEST 2009 i686 Genuine Intel(R) CPUT2300 @ 1.66GHz GenuineIntel GNU/Linux

```

Any info would be much appreciated here ...

----------

## rahulthewall

Is no one else experiencing the same problem with GMA 945, xorg-server-1.6 and intel-2.6.99.902? If you have the same hardware and do not have the problem, can you please share your xorg "Device" section configuration. Maybe I have something wrong in there.

----------

## alex.blackbit

 *rahulthewall wrote:*   

> 
> 
> ```
> (WW) intel(0): libpciaccess reported 0 rom size, guessing 64kB
> ```
> ...

 

i can report that i get the same message in the log on my system.

intel GM45.

xorg-server-1.6.1 (renamed ebuild, i was using 1.6.0 before with the same result).

xf86-video-intel-0.2.6.99.903 (renamed ebuild, 0.2.6.99.902 did the same).

gentoo-sources-2.6.29-r1

no memory problems.

```
# grep -Ev "^[[:blank:]]*(#|$)" /etc/X11/xorg.conf

Section "ServerLayout"

        Identifier     "X.org Configured"

        Screen      0  "Screen0" 0 0

EndSection

Section "Monitor"

        Identifier   "Monitor0"

        VendorName   "Monitor Vendor"

        ModelName    "Monitor Model"

EndSection

Section "Device"

        Option     "DRI"                        "True"

        Identifier  "Card0"

        Driver      "intel"

        VendorName  "Intel Corporation"

        BoardName   "Mobile 4 Series Chipset Integrated Graphics Controller"

        BusID       "PCI:0:2:0"

        Option      "AccelMethod"               "UXA"

        Option      "FramebufferCompression"    "False"

        Option      "XvMC"                      "True"

EndSection

Section "Screen"

        Identifier "Screen0"

        Device     "Card0"

        Monitor    "Monitor0"

        SubSection "Display"

                Viewport   0 0

                Depth     1

        EndSubSection

        SubSection "Display"

                Viewport   0 0

                Depth     4

        EndSubSection

        SubSection "Display"

                Viewport   0 0

                Depth     8

        EndSubSection

        SubSection "Display"

                Viewport   0 0

                Depth     15

        EndSubSection

        SubSection "Display"

                Viewport   0 0

                Depth     16

        EndSubSection

        SubSection "Display"

                Viewport   0 0

                Depth     24

        EndSubSection

EndSection

Section "dri"

        Mode 0666

EndSection

#
```

so, did you already check what is eating up your memory with htop or something similar?

i did not read that anywhere.

----------

## R.Aven

I'm experiencing the same issue with 2.6.29.1 and xorg-server-1.6 and the ~x86 xf86-video-intel. I'll have a further look on my Xorg.log tomorrow, but I'm glad to hear, that other people having the same trouble. Btw I have an "Intel GMA 4500MHD" graphics chip built into my laptop computer.

htop tells me, that X is using the most resources, although xrestop shows no X process which is using much memory usage compared to the time I start Xorg and after several hours, when the memory+swap is almost completly filled.

----------

## rahulthewall

More details, on this bug report

http://bugzilla.kernel.org/show_bug.cgi?id=12884

----------

## rahulthewall

Short Overview of the running processes: (excuse the formatting)

```
PID PPID RSS VSZ %CPU %MEM CMD

3346 3337 141348 222248 5.5 13.7 /usr/bin/X -br -novtswitch -quiet -nolisten

tcp :0 vt7 -auth /var/run/xauth/A:0-ZIfhmp

3787 1 20080 300968 0.9 1.9 /usr/bin/plasma

3810 1 6420 275696 0.0 0.6 /usr/bin/krunner

10693 3726 91572 265812 5.9 8.9 /usr/lib/mozilla-firefox/firefox

http://www.mercator-college.org/pics/thumbnails.php?album=102

10954 1 44336 165648 2.2 4.3 /usr/bin/kmail -caption KMail

3786 1 3748 141736 0.0 0.3 /usr/bin/knotify4

10488 10478 13348 125048 0.0 1.3 /usr/lib/openoffice/program/soffice.bin -

nologo -nodefault -accept=socket,host=0,port=8100;urp

10231 3726 21020 95696 0.2 2.0 /usr/bin/okular

/home/rahul/Courses/Current/CAOS/slides.pdf -icon okular -caption Okular

3758 3726 3956 79016 0.0 0.3 ksmserver

3729 1 6196 68416 0.0 0.6 kded4

10529 1 15664 66680 0.2 1.5 /usr/bin/konsole

3797 1 4340 61580 0.0 0.4 kxkb

3760 3758 7752 56216 5.4 0.7 kwin

```

@alex.blackbit - do you have KMS enabled?

And guys just as a note, my computer has the ancient GMA 945, not the fancy GM945 like you guys!  :Smile: 

And one more question - do you guys have compositing enabled? I am using openGL compositing on KDE-4.2.2.

```

Section "Device"

        Identifier      "Intel Corporation Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller"

        Driver          "intel"

        BusID           "PCI:0:2:0"

        Option          "AccelMethod"                   "UXA"

        Option          "FramebufferCompression"        "False"

        Option          "XvMC"                          "True"

EndSection

Section "Monitor"

        Identifier      "LVDS"

        Option          "DPMS"

EndSection

Section "Screen"

        Identifier      "Screen[0]"

        Device          "Intel Corporation Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller"

        Monitor         "LVDS"

        DefaultDepth    24

        SubSection "Display"

                Modes           "1400x1050" "1280x800" "1024x768" "800x600"

        EndSubSection

EndSection

Section "Extensions"

        Option          "Composite"     "Enable"

EndSection

Section "DRI"

        Mode 0666

EndSection

```

----------

## alex.blackbit

kms: yes.

compositing: no.

----------

## d2_racing

Maybe you should run htop to see actually what is eating your swap.

----------

## R.Aven

kms: no.

compositing: yes (compiz-fusion)

----------

## rahulthewall

htop does not show RSS and VSIZE for me, therefore I am not using it.

```

rahul@googly ~ $ ps -eo pid,rss,vsize,pcpu,pmem,cmd -ww --sort=-vsize | head

  PID   RSS    VSZ %CPU %MEM CMD

 4847 240464 631556 8.3 23.4 /usr/bin/X -br -novtswitch -quiet -nolisten tcp :0 vt7 -auth /var/run/xauth/A:0-xmN2Ev

 5727 54816 389244  3.1  5.3 /usr/bin/plasma

 5912  7832 241908  0.1  0.7 /usr/bin/krunner

 5791 15676 240620  0.1  1.5 /usr/bin/lancelot

19001 66624 230948  4.3  6.4 /usr/lib/mozilla-firefox/firefox

 5923  4312 142452  0.0  0.4 /usr/bin/knotify4

 5463  4304  79072  0.0  0.4 ksmserver

 5314  7632  74320  0.0  0.7 kded4

24921 13984  74120  0.3  1.3 /usr/bin/konsole

```

Why X is hogging a mind boggling 23.4% of the memory, I have no clue about ...

EDIT: Reported on the Xorg bugzilla

----------

## fr4nk

I don't know if it's related, but I got a similar memory problem with X. After a few hours of usage X uses more than a Gig of RAM:

```
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                         

 1627 root      20   0 1243m 1.0g 4432 S    1 52.2  26:30.62 X
```

I'm using nvidia-drivers-180.44 and xorg-server-1.6. I already tried downgrading to stable versions (in fact, I was hoping that 1.6 would fix this issue, since that was the reason for this upgrade). The nv driver seems even worse, with memory leaking at an even faster rate.

I've done some tests, and here is what I got so far:

- KDE doesn't seem to be the problem. I used KDE 4.2 when I first noticed the leak, but switched back to XMonad afterwards - problem persists, even when running no KDE apps at all.

- Just letting X sit there and idle for a few hours doesn't seem to increase mem usage. Well, I guess that's worth something.  :Laughing: 

- Using Firefox seems to drive X memory usage upwards, though Konqueror and Opera also seem to do that...   :Confused: 

----------

## K1LL3R DO6

Same problem here.

xorg-server 1.6.0, xf86-video-intel 2.6.99.902 and gentoo-sources 2.6.29-r1 (with gnome).

xorg.conf http://pastebin.ca/1401609

make.conf http://pastebin.ca/1401610

----------

## Cyker

I think you're on the right track thinking it is a problem with xorg; I don't see the same memory guzzling symptoms with TightVNC, which uses an antiquated version of XFree86. Unfortunately, KTorrent more than makes up for this (It's eaten 1.5GB of RAM so far!  :Shocked: )

[quote="rahulthewall"]htop does not show RSS and VSIZE for me, therefore I am not using it.

I see you added the columns; Good!

OOC, what htop are you using? I am using 0.81 and it's working perfectly on mine...

----------

## rahulthewall

I am putting it down as a compositing related problem - have been running KDE with compositing off this morning.

Here are the statistics:

```

rahul@googly ~ $ uptime

 11:33:59 up  1:45,  3 users,  load average: 0.19, 0.90, 1.21

rahul@googly ~ $ free -m

             total       used       free     shared    buffers     cached

Mem:          1001        950         50          0        236        478

-/+ buffers/cache:        235        765

Swap:         1027          0       1027

```

Other changes that I made to the system (might have an effect)

- Changed the plasma theme (Glassified -> Glaze)

- redland got upgraded (doubt that helped)

- installed enlightenment (would be funny if that solved the problem)

And I actually ran Enlightenment (again without compositing) for quite some time yesterday (with KDE applications like Kmail, even Virtualbox was running), here are the statistics from that:

```

rahul@googly ~ $ uptime

 22:32:25 up  4:15,  5 users,  load average: 0.34, 0.19, 0.27

rahul@googly ~ $ free -m

             total       used       free     shared    buffers     cached

Mem:          1001        565        435          0         11        438

-/+ buffers/cache:        116        885

Swap:         1027         36        991 

```

So, right now, I am assuming (with substantial evidence, I believe), that it is a compositing issue - whether KDE related or Xorg related - I have no idea! 

Cheers

Rahul

----------

## rahulthewall

Entirely the fault of xorg-server-1.6.0

https://bugs.gentoo.org/show_bug.cgi?id=262512

----------

## alex.blackbit

did you already try xorg-server-1.6.1? maybe it fixes the problem.

----------

## rahulthewall

1.6.1 fixes it mostly, forgot to mention that!

----------

