进程间通信出现shmget error:Invalid argument的其中一个原因
During the test program, often used to run Ctrl + C to terminate the program. Since the program may exist in certain sub-process is not over yet, still occupy the shared memory, and therefore error: shmget error: Invalid argument, because the key value is still in use (shared memory that is not released / not available).
Solution:
First, use the command ipcs -m to view the status of shared memory
General situation last record still holds the shared memory is the recent termination of the program, and then use the process ps -a view that are running, use the kill command to kill the child process, then use ipcrm -m shmID delete shared memory.
Ipc link command reference:
(1) Linux shared memory management
https://www.cnblogs.com/wt645631686/p/9151029.html