A few things you might try:
1. Set RLIMIT_DATA or RLIMIT_AS for your processes
using ulimit. That should cause malloc() and the
like to return NULL or throw an exception if you go
over the limit. (RLIMIT_AS doesn't work too well
on heavily multithreaded programs, though, because
of the many stacks.)
2. Try the no-overcommit patch. That will fail
allocation requests that might conceivably cause swapping
later. Harsh, but you did want early notification :-)
3. Start reading the kernel source to see how it calculates
memory use and enforces the above limits. That helped
clarify things for me a bit.
4. If you're feeling really nasty, you could try applying
my patch that implements RLIMIT_RSS by killing the process.
That's pretty immediate feedback, too :-)
- Dan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/