One of the reasons Invalid argument: The inter-OS interprocess communication shmget error

进程间通信出现shmget error:Invalid argument的其中一个原因

Here Insert Picture Description
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

Here Insert Picture Description

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

Guess you like

Origin blog.csdn.net/JxufeCarol/article/details/90297425