Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 May 1998 13:05:52 -0700 (PDT)
From:      craig@tuna.progroup.com (Craig W. Shaver)
To:        questions@FreeBSD.ORG
Subject:   leaking shm segments (fwd)
Message-ID:  <199805132005.NAA15933@ProGroup.COM>

next in thread | raw e-mail | index | archive | help
> Content-Length: 568
> 
> 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.
> 
> 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).
> 
> Any suggestions?

This is the expected behavior.  Rewrite the process to check on the
same token/key value for existing shm segments when opening/creating
the shm.  (Do not set the create flag and check the error return and
the errno value.)

Or, figure out what key value you are using with the segment in
question and use ipcrm in a shell script to delete it when you start
the process.........

> 
>  thanks,
>   - Jaspal
> 
-- 
Craig Shaver  (craig@progroup.com) (415)390-0654 
Productivity Group POB 60458 Sunnyvale, CA  94088

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?199805132005.NAA15933>