1847860 Members
2624 Online
104021 Solutions
New Discussion

Re: ipcs ipcrm

 

ipcs ipcrm

hello,
my user has one application which alocates some space in shared memory and if failed doesnt dealocate those space and because this reason cannot be restarted. Is it posible to recognize this space with ipcs and release it with ipcrm command. Thanks. Hrvoje
4 REPLIES 4
Jeff Machols
Esteemed Contributor

Re: ipcs ipcrm

As long as nothing is still attached to it, you can do an ipcrm -m ID

if you do an ipcs -m

and look up the memory id, if there is a D in front of the address, that means there is something still attached and you cannot remove the shmem until that processes is killed
Frederic Sevestre
Honored Contributor

Re: ipcs ipcrm

Hi,

You can find the unused memory with ipcs -ma .
If NATTCH is 0, the memory isn't used anymore.
You can free it with ipcrm -m

Fr??d??ric
Crime doesn't pay...does that mean that my job is a crime ?
Uday_S_Ankolekar
Honored Contributor

Re: ipcs ipcrm

Hi,

ipcs -moba will display all the application with shared memory.

you can release shared memeory those have 0 NATTACH by ipcrm -m followed by ID number of ipcs -moba output.

-USA..
Good Luck..
Roger Baptiste
Honored Contributor

Re: ipcs ipcrm

Hi,

here is an example:

#ipcs -am
IPC status from /dev/kmem as of Tue Dec 11 10:01:29 2001
T ID KEY MODE OWNER GROUP CREATOR CGROUP NATTCH SEGSZ CPID LPID ATIME DTIME CTIME
Shared Memory:
m 0 0x4118061a --rw-rw-rw- root root root root 0 348 2120 2120 12:06:28 12:06:28 12:06:21
m 1 0x4e0c0002 --rw-rw-rw- root root root root 1 31040 2120 2120 12:06:24 12:06:28 12:06:21
m 2 0x411c0774 --rw-rw-rw- root root root root 1 8192 2120 2132 12:06:24 12:06:21 12:06:21
m 5123 0x0c6629c9 --rw-r----- root root root root 2 23754620 2699 24610 3:27:09 3:27:40 12:07:07
m 4 0x06347849 --rw-rw-rw- root root root root 1 77384 2699 2742 12:07:17 12:07:07 12:07:07
m 2053 0xffffffff --rw-r--rw- root root root root 0 22908 2685 2685 12:07:14 12:07:14 12:07:14
m 612358 0x87380382 --rw------- controlm controlm controlm controlm 1 21475328 15019 15019 12:43:36 no-entry 12:43:36
m 46812 0x00000000 D-rw------- oracle oracle oracle oracle 18 8000008 20539 20640 15:00:28 no-entry 15:00:30
***

To remove a specific shared memory segment do,
ipcrm -m (second column)

Be sure, before you do this!!
Check to see whether the NATTCH associated with the segment is 0.

Also, if the first bit on the mode is D , then you wouldnt need to do ipcrm, since it is already removed.

HTH
raj
Take it easy.