
As I understand it, the Linux OOM killer may *still* kill your application even if your application is "well behaved" (in the sense that it isn't actually responsible for the allocation that causes the OOM condition). It certainly doesn't always pick the application that caused the allocation failure.
That's true. My test program killed mysqld yesterday that was minding its own business. But it is the best you can do. I don't want to be the application that triggers the OOM-killer. Imagine a server that does dedicated proxying, that all of a sudden takes a heavy load. That load shouldn't trigger the OOM-killer. If all your critical processes are running, they are all pre-alloced, and you have some memory to spare, you are basically are good. This is getting off topic, but pre-allocation is good for many server apps and leave it at that.