When run with either underflow or overflow checking enabled, mprotect will fail after around 32,570 "protections", with errno 12 (ENOMEM Internal kernel structures could not be allocated.)
I am assuming this this is because of a limit on the space allowed in the kernel to store memory protection structures, I guess per process. It seems to consistently fail around that 32,570 number on this machine, whether underflow or overflow checking is used.
Is anyone familiar with this, or am I mistaken? Windows seems fine with almost a million "protections".