Xorg가 점점 더 많은 메모리를 소비하기 시작하여 결국 전체 스왑 공간을 소진시키는 문제에 직면해 있습니다. 아래 그림과 같이 Xorg의 가상 메모리는 약 1.1GB입니다. 내 시스템은 하나의 GTK 애플리케이션 "main_app"만 실행하며 Gnome은 없고 IceWM만 설치되어 있습니다. 이런 일이 발생하면 시스템이 크롤링되며 재부팅을 통해서만 복구할 수 있습니다.
top - 00:01:09 up 24 days, 6:51, 6 users, load average: 6.89, 3.63, 2.76
Tasks: 126 total, 1 running, 123 sleeping, 2 stopped, 0 zombie
Cpu(s): 1.0%us, 3.4%sy, 0.0%ni, 0.0%id, 95.6%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 505644k total, 442536k used, 63108k free, 1424k buffers
Swap: 2095096k total, 1246372k used, 848724k free, 16400k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1598 root 19 -1 1145m 39m 1308 S 0 8.0 375:06.84 Xorg
2293 root 20 0 100m 6876 3932 S 2 1.4 747:08.62 main_app
514 root 20 0 53460 324 140 S 0 0.1 70:38.16 net.agent
1998 root 20 0 53460 368 140 S 0 0.1 70:40.18 net.agent
23787 root 20 0 53460 9980 196 D 1 2.0 0:00.21 net.agent
23801 root 20 0 53460 9248 196 D 1 1.8 0:00.19 net.agent
1343 root 20 0 28472 804 564 S 0 0.2 0:03.88 rsyslogd
3179 root 20 0 23712 180 136 S 0 0.0 0:15.82 MSPAgent
아래에 표시된 대로 /proc/pid/smaps는 xorg의 힙이 전체 1.1GB를 보유하고 있음을 보여줍니다.
08231000-4da43000 rw-p 00000000 00:00 0 [heap]
Size: 1138760 kB
Rss: 35444 kB
Pss: 35444 kB
Shared_Clean: 0 kB
Shared_Dirty: 0 kB
Private_Clean: 1476 kB
Private_Dirty: 33968 kB
Referenced: 26436 kB
Swap: 1103276 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
xrestop을 실행했는데 "main_app"이 범인이 아니라는 것을 알았습니다.
xrestop - Display: :0.0
Monitoring 9 clients. XErrors: 0
Pixmaps: 1465K total, Other: 35K total, All: 1500K total
res-base Wins GCs Fnts Pxms Misc Pxm mem Other Total PID Identifier
0e00000 7 30 2 8 27 1378K 3K 1381K 2293 main_app
0c00000 67 8 1 38 840 87K 22K 109K ? <unknown>
0800000 2 7 6 1 22 0B 6K 6K 1647 uxterm
0000000 1 0 2 0 36 0B 2K 2K ? <unknown>
0a00000 2 1 0 0 1 0B 96B 96B ? <unknown>
1000000 1 1 0 0 0 0B 48B 48B ? xrestop
0400000 1 1 0 0 0 0B 48B 48B ? <unknown>
0600000 0 1 0 0 0 0B 24B 24B ? <unknown>
0200000 0 1 0 0 0 0B 24B 24B ? <unknown>
xorg가 왜 계속 성장하는지 모르겠습니다. 어디를 봐야 할지, 무엇을 찾아야 할지 몇 가지 조언을 부탁드립니다.
저는 Debian Linux를 사용하고 있습니다: debian:~# uname -a Linux debian 2.6.32-5-686 #1 SMP Tue Mar 8 21:36:00 UTC 2011 i686 GNU/Linux debian:~#
인텔(R) 아톰(TM) CPU N270 @ 1.60GHz
다음은 xorg 프로세스의 pmap 출력입니다. 흥미롭게도 총 용량은 1.1GB이지만 개별 항목을 합산해도 그다지 많지 않습니다.
debian:~# pmap -x 1598 | more
1598: /usr/bin/X :0 -br -nocursor -auth /tmp/serverauth.O1gWpWvWuP
Address Kbytes RSS Dirty Mode Mapping
08048000 0 404 0 r-x-- Xorg
081e3000 0 24 12 rw--- Xorg
081ef000 0 40 24 rw--- [ anon ]
08231000 0 36188 35232 rw--- [ anon ]
b5422000 0 1892 1888 rw--- [ anon ]
b59a1000 0 384 0 rw-s- [ shmid=0x520000 ]
b5bd6000 0 0 0 rw--- [ anon ]
b5e85000 0 0 0 r-x-- libexpat.so.1.5.2
b5ea9000 0 0 0 rw--- libexpat.so.1.5.2
b5eab000 0 0 0 r-x-- evdev_drv.so
b5eb3000 0 0 0 rw--- evdev_drv.so
b5eb4000 0 0 0 r-x-- swrast_dri.so
b60c8000 0 0 0 rw--- swrast_dri.so
b60cd000 0 1876 1876 rw--- [ anon ]
b6f83000 0 3072 0 rw-s- fb0
b7283000 0 8 0 r-x-- libshadow.so
b7288000 0 4 4 rw--- libshadow.so
b7289000 0 56 0 r-x-- libfb.so
b72a6000 0 4 4 rw--- libfb.so
b72a7000 0 0 0 r-x-- libfbdevhw.so
b72ab000 0 0 0 rw--- libfbdevhw.so
b72ac000 0 4 0 r-x-- fbdev_drv.so
b72b0000 0 4 0 rw--- fbdev_drv.so
b72b1000 0 0 0 r-x-- librecord.so
b72b7000 0 0 0 rw--- librecord.so
b72b8000 0 12 0 r-x-- libglx.so
b7307000 0 8 0 rw--- libglx.so
b730a000 0 12 0 r-x-- libselinux.so.1
b7323000 0 0 0 r---- libselinux.so.1
b7324000 0 0 0 rw--- libselinux.so.1
b7325000 0 0 0 r-x-- libextmod.so
b7341000 0 4 4 rw--- libextmod.so
b7343000 0 0 0 r-x-- libdrm.so.2.4.0
b734c000 0 0 0 rw--- libdrm.so.2.4.0
b734d000 0 0 0 r-x-- libdri.so
b7355000 0 0 0 rw--- libdri.so
b7356000 0 0 0 r-x-- libgcc_s.so.1
b7373000 0 0 0 rw--- libgcc_s.so.1
b7374000 0 4 4 rw--- [ anon ]
b7376000 0 0 0 r-x-- libgpg-error.so.0.4.0
b7379000 0 0 0 rw--- libgpg-error.so.0.4.0
b737a000 0 0 0 r-x-- libfontenc.so.1.0.0
b737f000 0 0 0 rw--- libfontenc.so.1.0.0
b7380000 0 0 0 r-x-- libbz2.so.1.0.4
b7390000 0 0 0 rw--- libbz2.so.1.0.4
b7391000 0 0 0 r-x-- libfreetype.so.6.6.0
b7404000 0 0 0 rw--- libfreetype.so.6.6.0
b7408000 0 0 0 r-x-- libz.so.1.2.3.4
b741b000 0 0 0 rw--- libz.so.1.2.3.4
b741c000 0 0 0 rw--- [ anon ]
b741d000 0 128 0 r-x-- libc-2.11.2.so
b755d000 0 4 0 r---- libc-2.11.2.so
b755f000 0 4 0 rw--- libc-2.11.2.so
b7560000 0 8 4 rw--- [ anon ]
b7563000 0 8 0 r-x-- librt-2.11.2.so
b756a000 0 4 0 r---- librt-2.11.2.so
b756b000 0 0 0 rw--- librt-2.11.2.so
b756c000 0 4 0 r-x-- libm-2.11.2.so
b7590000 0 0 0 r---- libm-2.11.2.so
b7591000 0 0 0 rw--- libm-2.11.2.so
b7592000 0 0 0 r-x-- libaudit.so.0.0.0
b75a9000 0 4 0 r---- libaudit.so.0.0.0
b75aa000 0 0 0 rw--- libaudit.so.0.0.0
b75ab000 0 0 0 r-x-- libgcrypt.so.11.5.3
b761c000 0 8 4 rw--- libgcrypt.so.11.5.3
b761f000 0 0 0 r-x-- libXdmcp.so.6.0.0
b7623000 0 0 0 rw--- libXdmcp.so.6.0.0
b7624000 0 0 0 rw--- [ anon ]
b7625000 0 72 0 r-x-- libpixman-1.so.0.16.4
b767c000 0 8 0 rw--- libpixman-1.so.0.16.4
b767e000 0 0 0 r-x-- libXau.so.6.0.0
b7680000 0 0 0 rw--- libXau.so.6.0.0
b7681000 0 8 0 r-x-- libXfont.so.1.4.1
b76b5000 0 0 0 rw--- libXfont.so.1.4.1
b76b7000 0 12 0 r-x-- libpthread-2.11.2.so
b76cc000 0 4 0 r---- libpthread-2.11.2.so
b76cd000 0 0 0 rw--- libpthread-2.11.2.so
b76ce000 0 0 0 rw--- [ anon ]
b76d0000 0 4 0 r-x-- libdl-2.11.2.so
b76d2000 0 4 0 r---- libdl-2.11.2.so
b76d3000 0 0 0 rw--- libdl-2.11.2.so
b76d4000 0 4 0 rw--- [ anon ]
b76d5000 0 0 0 r-x-- libpciaccess.so.0.10.8
b76dc000 0 0 0 rw--- libpciaccess.so.0.10.8
b76dd000 0 4 0 r-x-- libudev.so.0.9.3
b76e9000 0 0 0 r---- libudev.so.0.9.3
b76ea000 0 0 0 rw--- libudev.so.0.9.3
b76eb000 0 0 0 r-x-- libdri2.so
b76ed000 0 0 0 rw--- libdri2.so
b76ee000 0 16 0 r-x-- libdbe.so
b76f2000 0 4 0 rw--- libdbe.so
b76f3000 0 4 0 rw--- [ anon ]
b76f6000 0 4 0 r-x-- [ anon ]
b76f7000 0 8 0 r-x-- ld-2.11.2.so
b7712000 0 0 0 r---- ld-2.11.2.so
b7713000 0 0 0 rw--- ld-2.11.2.so
bfcb7000 0 16 16 rw--- [ stack ]
-------- ------- ------- ------- -------
total kB 1197560 - - -
debian:~#
pmap -d는 익명 매핑에 대해 매핑된 1.1GB를 표시합니다.
debian:~# pmap -d 1598 | more
1598: /usr/bin/X :0 -br -nocursor -auth /tmp/serverauth.O1gWpWvWuP
Address Kbytes Mode Offset Device Mapping
08048000 1644 r-x-- 0000000000000000 008:00001 Xorg
081e3000 48 rw--- 000000000019b000 008:00001 Xorg
081ef000 44 rw--- 0000000000000000 000:00000 [ anon ]
08231000 1164236 rw--- 0000000000000000 000:00000 [ anon ]
b5422000 3752 rw--- 0000000000000000 000:00000 [ anon ]
b59a1000 384 rw-s- 0000000000000000 000:00004 [ shmid=0x520000 ]
이제 주소 08231000의 소유자를 식별할 방법이 필요합니다.
컨트롤러는 아래와 같습니다.
debian:~# lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation Mobile 945GME Express Integrated Graphics Controller (rev 03)
debian:~#
데비안:~#
Xorg가 로드하는 모듈은 다음과 같습니다:
debian:~# grep -i "Loading" /var/log/Xorg.0.log
(II) Loading /usr/lib/xorg/modules/extensions/libdbe.so
(II) Loading extension DOUBLE-BUFFER
(II) Loading /usr/lib/xorg/modules/extensions/libdri2.so
(II) Loading extension DRI2
(II) Loading /usr/lib/xorg/modules/extensions/libextmod.so
(II) Loading extension SELinux
(II) Loading extension MIT-SCREEN-SAVER
(II) Loading extension XFree86-VidModeExtension
(II) Loading extension XFree86-DGA
(II) Loading extension DPMS
(II) Loading extension XVideo
(II) Loading extension XVideo-MotionCompensation
(II) Loading extension X-Resource
(II) Loading /usr/lib/xorg/modules/extensions/libdri.so
(II) Loading extension XFree86-DRI
(II) Loading /usr/lib/xorg/modules/extensions/libglx.so
(II) Loading extension GLX
(II) Loading /usr/lib/xorg/modules/extensions/librecord.so
(II) Loading extension RECORD
(II) Loading /usr/lib/xorg/modules/drivers/fbdev_drv.so
(II) Loading sub module "fbdevhw"
(II) Loading /usr/lib/xorg/modules/linux/libfbdevhw.so
(II) Loading sub module "fb"
(II) Loading /usr/lib/xorg/modules/libfb.so
(II) Loading sub module "shadow"
(II) Loading /usr/lib/xorg/modules/libshadow.so
(II) Loading /usr/lib/xorg/modules/input/evdev_drv.so
debian:~#
debian:~# /usr/bin/Xorg -version
X.Org X Server 1.7.7
Release Date: 2010-05-04
X Protocol Version 11, Revision 0
Build Operating System: Linux 2.6.32.29-dsa-ia32 i686 Debian
Current Operating System: Linux debian 2.6.32-5-686 #1 SMP Tue Mar 8 21:36:00 UTC 2011 i686
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-2.6.32-5-686 root=/dev/sda1 nomodeset
Build Date: 19 February 2011 02:37:36PM
xorg-server 2:1.7.7-13 (Cyril Brulebois <[email protected]>)
Current version of pixman: 0.16.4
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
debian:~#
답변1
버전 5.0 이후 VirtualBox를 사용할 때도 동일한 문제가 발생했습니다. Xorg 프로세스 메모리는 느리지만 꾸준히 6G로 증가합니다.
문제를 해결하기 mit-shm
위해 옵션을 비활성화했습니다 . xorg.conf
다음 옵션을 추가할 수 있습니다.
Section "Extensions"
Option "MIT-SHM" "disable"
EndSection