Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Nov 2000 14:34:12 -0800
From:      Christian Lacunza <Christian.Lacunza@Eng.Sun.COM>
To:        Erik Rothwell <erothwell@callgtn.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Gdk-WARNING: shmget() failed & Other SHM problems.
Message-ID:  <3A26D5E4.F8E40C1D@eng.sun.com>

next in thread | raw e-mail | index | archive | help

hi Erik.

FreeBSD leaks a lot of shared memory.

according to your ipcs -M output,
your system is only configured for 1024 pages of shared memory.
at 4k per page, that's 4MB.
this will tell you how much of that you are currently using:

     $ ipcs -ma | awk '{s+=$10}END{print s/1024, "kB"}'
     492 kB
     $ 

my guess is that if you run ipcs -ma, you'll probably see many lines with
one or more of the following properties:

     1. the pid listed under CPID or LPID does not match any running process.
     2. NATTCH == 1
     3. NATTCH == 0

those segments are taking up space, but aren't being used.
you might be able to recover some of them with ipcrm,
but there will also be some for which this happens:

     $ ipcrm -m 5701638
     ipcrm: shmid(5701638): : Invalid argument
     $

even though 5701638 is listed by ipcs.
the only way to get rid of those is to reboot.

you can reboot less frequently if you increase your limits on
shared memory so the leaked segments have more room to accumulate.
this sets the maximum amount of shared memory to 64MB.

     $ sysctl -w kern.ipc.shmmax=67108864
     $ sysctl -w kern.ipc.shmall=16384

and you can add these lines to sysctl.conf:

     kern.ipc.shmmax=67108864
     kern.ipc.shmall=16384

-- christian.



> Hi folks,
> 
> I've come across the most frustrating problem that I can't seem to find
> any information about anywhere.
> 
> Shared memory.
> 
> I'm not even sure what shared memory actually is, except that everything
> X11 wants it. And nothing I run, it seems, is getting any of it. Doesn't
> matter what program I run, at what stage in the computer's uptime,
> always always always: Gdk-WARNING: shmget() failed, or, various IMLIB
> errors pertaining to SHM.
> 
> Now, the only information I was able to find regarding SysV shared
> memory and FreeBSD was a discussion group posting explaining how to
> increase the max segment size, which I did in my kernel.
> 
> Here's some info:
> 
> bacchusrx% ipcs -M
> 
> shminfo:
>         shmmax: 67108864        (max shared memory segment size)
>         shmmin:       1 (min shared memory segment size)
>         shmmni:    4096 (max number of shared memory identifiers)
>         shmseg:     256 (max shared memory segments per process)
>         shmall:    1024 (max amount of shared memory in pages)
> 
> Also, I checked out this imlib thing and shared memory is all turned on
> and fuzzy there, so I can't figure this one out.
> 
> Absolutely everything wants this shared memory stuff, but nobody seems
> to be getting any... which I think is causing problems when I do
> multimedia stuff as well...
> 
> I'm running FreeBSD 4.2 with XFree86 3.3.6 with GNOME 1.2 and
> Enlightenment 0.16.4 or .5 I don't remember.
> 
> If I just type "ipcs" I get:
> 
> Message Queues:
> T     ID     KEY        MODE       OWNER    GROUP
> 
> Shared Memory:
> T     ID     KEY        MODE       OWNER    GROUP
> m 2228224          0 --rwarwarwa bacchusrx    wheel
> m 2293761          0 --rwarwarwa bacchusrx    wheel
> m 2293762          0 --rwarwarwa bacchusrx    wheel
> m 2293763          0 --rwarwarwa bacchusrx    wheel
> m 2162692          0 --rwarwarwa bacchusrx    wheel
> m 78708741          0 --rwarwarwa bacchusrx    wheel
> m 103743494          0 --rwarwarwa bacchusrx    wheel
> m 1122238471          0 --rwarwarwa bacchusrx    wheel
> m 1653735432          0 --rwarwarwa bacchusrx    wheel
> m 1028784137          0 --rwarwarwa bacchusrx    wheel
> m 86704138          0 --rwarwarwa bacchusrx    wheel
> m 835649547          0 --rwarwarwa bacchusrx    wheel
> m 620429324          0 --rwarwarwa bacchusrx    wheel
> m 10289165          0 --rwarwarwa bacchusrx    wheel
> m 18219022          0 --rwarwarwa bacchusrx    wheel
> m 229572623          0 --rwarwarwa bacchusrx    wheel
> m 691601424          0 --rwarwarwa bacchusrx    wheel
> m 10682385          0 --rwarwarwa bacchusrx    wheel
> m 28442642          0 --rwarwarwa bacchusrx    wheel
> m 45088787          0 --rwarwarwa bacchusrx    wheel
> m 248446996          0 --rwarwarwa bacchusrx    wheel
> m 824705045          0 --rwarwarwa bacchusrx    wheel
> m 838467606          0 --rwarwarwa bacchusrx    wheel
> m 5767191          0 --rwarwarwa bacchusrx    wheel
> m 691732504          0 --rwarwarwa bacchusrx    wheel
> m 1506344985          0 --rwarwarwa bacchusrx    wheel
> m 1189216282          0 --rwarwarwa bacchusrx    wheel
> m 50528283          0 --rwarwarwa bacchusrx    wheel
> m 40173596          0 --rwarwarwa bacchusrx    wheel
> m 1323237405          0 --rwarwarwa bacchusrx    wheel
> m 284688414          0 --rwarwarwa bacchusrx    wheel
> m 1390805023          0 --rwarwarwa bacchusrx    wheel
> m 742981664          0 --rwarwarwa bacchusrx    wheel
> m 104136737          0 --rwarwarwa bacchusrx    wheel
> m 16056354          0 --rwarwarwa bacchusrx    wheel
> m 862388259          0 --rwarwarwa bacchusrx    wheel
> m 66846756          0 --rwarwarwa bacchusrx    wheel
> m 27787301          0 --rwarwarwa bacchusrx    wheel
> m 777846822          0 --rwarwarwa bacchusrx    wheel
> m 88670247          0 --rwarwarwa bacchusrx    wheel
> m 177340456          0 --rwarwarwa bacchusrx    wheel
> m 109641769          0 --rwarwarwa bacchusrx    wheel
> m 1986986026          0 --rwarwarwa bacchusrx    wheel
> m 174063659          0 --rwarwarwa bacchusrx    wheel
> m 1984823340          0 --rwarwarwa bacchusrx    wheel
> m 1922891821          0 --rwarwarwa bacchusrx    wheel
> m 118226990          0 --rwarwarwa bacchusrx    wheel
> m 305201199          0 --rwarwarwa bacchusrx    wheel
> m 432472112          0 --rwarwarwa bacchusrx    wheel
> m 1760952369          0 --rwarwarwa bacchusrx    wheel
> m 1878982706          0 --rwarwarwa bacchusrx    wheel
> m 967442483          0 --rwarwarwa bacchusrx    wheel
> m 798425140          0 --rwarwarwa bacchusrx    wheel
> m 1093992501          0 --rwarwarwa bacchusrx    wheel
> m 2092171318          0 --rwarwarwa bacchusrx    wheel
> m 113049655          0 --rwarwarwa bacchusrx    wheel
> m 129695800          0 --rwarwarwa bacchusrx    wheel
> m 30081081          0 --rwarwarwa bacchusrx    wheel
> m 36175930          0 --rwarwarwa bacchusrx    wheel
> m 23134267          0 --rwarwarwa     root    wheel
> m 4849724          0 --rwarwarwa bacchusrx    wheel
> m 9961533          0 --rw-rw-rw- bacchusrx    wheel
> m 8585278          0 --rw-rw-rw- bacchusrx    wheel
> m 121634879          0 --rwarwarwa bacchusrx    wheel
> m 113770560          0 --rwarwarwa bacchusrx    wheel
> m 1124401217          0 --rwarwarwa bacchusrx    wheel
> m 1381105730          0 --rwarwarwa bacchusrx    wheel
> m 629014595          0 --rwarwarwa     root    wheel
> 
> Semaphores:
> T     ID     KEY        MODE       OWNER    GROUP
> 
> 
> But that's all greek to me.
> 
> What's going on?
> 
> Erik.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A26D5E4.F8E40C1D>