Bug#256109: libapr0: apr shared memory segments stick around forever if there's a crash
On Mon, Jun 28, 2004 at 05:24:37PM -0700, Tyler 'Crackerjack' MacDonald wrote:
> I can understand the kernel not knowing that the memory is no longer used
> if there was still a straggler process hanging onto it. But when there are
> no processes left to access it, why does this continue to happen? If memory
> doesnt belong to any process at all, shouldn't it be, well, free? Regular
> memory works this way, files and filehandles work this way, why doesn't
> shared memory? Is it really that hard to keep a count of running processes
> that have opened a shared memory segment?
It wouldn't be hard for the kernel to do at all. But unfortunately,
the crack-smokers who wrote POSIX.4 decided that IPC was different.
The kernel is *required* to keep them around after all processes exit.
> And if this is a deficiency of the linux kernel, shouldn't APR, as a
> Portability library, be ready to handle this quirk and clean up for you,
> either automatically, or via a portable equivalent to ipcrm, etc?
Yes, I would agree with that.
"Next the statesmen will invent cheap lies, putting the blame upon
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince
himself that the war is just, and will thank God for the better sleep
he enjoys after this process of grotesque self-deception." -- Mark Twain