Agreed, there should be some better way to see which of sysv ipc resources are actually in use currently. All of these are supposed to be persistent (you can reattach to a shared memory segment later on). Considering that they are persistent, they need to be cleaned up just like another much more common resource: files on the filesystem. There is no built in support for garbage collection of files either.
I find the whole key and id thing to be a somewhat weird part of sysv ipc too, but it does allow you to consistently reattach to existing resources and avoid some collisions, but it just moves the identifier collision management from ints to key_ts, or with ftok(3), to file paths. See the NOTES section for ftok(3).
However, I didn't design this stuff, I just manage and maintain it.
I find the whole key and id thing to be a somewhat weird part of sysv ipc too, but it does allow you to consistently reattach to existing resources and avoid some collisions, but it just moves the identifier collision management from ints to key_ts, or with ftok(3), to file paths. See the NOTES section for ftok(3).
However, I didn't design this stuff, I just manage and maintain it.