Cleaning Up

One last important note:

The CAVElib uses shared memory to communicate between processes. When your program exits normally, by calling CAVEExit(), this shared memory is cleaned up automatically.

If your program crashes, or is killed by Ctrl-C, this won't happen. In that case, the shared memory is left around, cluttering the system memory.

If this happens a few times, you won't be able to run a CAVE program any more. You'll get error messages like:

CAVE ERROR (CAVEipcNewLock): semget failed
semget: No space left on device
CAVE ERROR (CAVEipcNewSema): semget failed
semget: No space left on device

To clean up the shared memory, run /util/CAVE/bin/cleanIPC.

You should remember to run this any time your program crashes or you kill it abnormally.

You can see what shared memory is currently lying around using the command ipcs.

[dave@mediastudy12 12]$ ipcs

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x00000000 218202112  root      777        1074832    2
0x00000000 218333185  root      644        110592     15         dest
0x00000000 218529794  root      644        151552     5          dest
0x00000000 218398723  root      644        110592     2          dest
0x00000000 218431492  root      644        110592     2          dest
0x00000000 218464261  root      644        110592     7          dest
0x00000000 218497030  root      644        118784     3          dest
0x00000000 218562567  root      644        151552     5          dest
0x00000000 218595336  root      644        110592     4          dest
0x00000000 218628105  root      644        110592     2          dest
0x00000000 218660874  root      644        122880     3          dest
0x00000000 219774987  root      644        110592     1          dest
0x00000000 221806604  root      644        110592     2          dest
0x00000000 219840525  root      644        110592     2          dest
0x0000101e 720910     root      666        1308       1
0x0000101f 753679     root      666        296        1
0x00000000 221839376  root      644        118784     2          dest
0x00000000 220266513  root      644        110592     3          dest
0x00000000 222756882  dave      644        262144     0
0x00000000 222789651  dave      644        8388612    0
0x00000000 222822420  dave      644        197968     0
0x00000000 220659733  root      644        110592     2          dest

------ Semaphore Arrays --------
key        semid      owner      perms      nsems      status
0x00000000 47841280   dave      660        1
0x00000000 47874049   dave      660        1
0x00000000 47906818   dave      660        1
0x00000000 47939587   dave      660        1
0x00000000 47972356   dave      660        1
0x00000000 48005125   dave      660        1
0x00000000 48037894   dave      660        1
0x00000000 48070663   dave      660        1
0x00000000 48103432   dave      660        1
0x00000000 48136201   dave      660        1
0x00000000 48168970   dave      660        1
0x00000000 48201739   dave      660        1
0x00000000 48234508   dave      660        1
0x00000000 48267277   dave      660        1
0x00000000 48300046   dave      660        1
0x00000000 48332815   dave      660        1
0x00000000 48365584   dave      660        1


next