Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 May 1998 14:54:41 -0400 (EDT)
From:      CyberPeasant <djv@bedford.net>
To:        jaspal@best.com (Jaspal Kohli)
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: leaking shm segments
Message-ID:  <199805131854.OAA05851@castor.loco.net>
In-Reply-To: <3559CC2E.2BAEE281@best.com> from Jaspal Kohli at "May 13, 98 09:37:03 am"

next in thread | previous in thread | raw e-mail | index | archive | help
Jaspal Kohli wrote:
> If a process creates a shared memory segment using shmget() and exits
> without
> deleting it via shmctl(), the segment does not get deleted.  Since this
> is a limited
> resource in the kernel, the system will run out of shm segments.

Well, you can run out of inodes, too.

> It was not clear to me from the man pages whether this is the expected
> behavior
> or whether this is a kernel bug (i.e. shm segments should be deleted
> when the
> creating process exits).
> 

This is normal behavior. These segments are more like files than
anything else -- global resources that may be accessed by any process
on the system, subject to permissions. [An extension to the semantics
on some OS's allows access from different machines over a network].
Unlike files, they only live from boot to boot.

shmctl can be used to make them have the delete-when-unreferenced
property, if that's what your app. needs, using IPC_RMID.

Similar remarks apply to SysV semaphores and message queues.

Dave
-- 
                <----.   mail-to: djv@bedford.net
                <----|===================================
                <----'  Zber Qnrzbaf, Srjre Qrivyf! 

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?199805131854.OAA05851>