What supported behaviour, if any, may applications rely on for inherited RLIMIT_AS when launching a process on macOS on Apple silicon using posix_spawn and subsequent exec transitions?
An older published XNU header defines RLIMIT_AS:
XNU resource.h (immutable revision)
I am looking for the documented support and virtual-address-space accounting scope, including exclusions.
For a finite limit already set in the launching process, does any documented guarantee cover the new process from its first executable or dynamic-loader mapping and across later exec transitions, or does the limit take effect at a later stage? If the limit cannot be applied, does launch abort before any target user code executes, what failure is reported, and can mappings occur before that failure? An explicit statement that this guarantee is not provided would also be helpful.
My question concerns virtual address space, rather than resident memory or a language runtime's heap. A successful setter or getrlimit readback by itself does not answer when the limit takes effect.
If an answer relies on published XNU code, what public release/build record would be needed to relate an immutable source revision to a released macOS build on Apple silicon, and what limits apply to that correspondence? I am asking about the supported public interface and publicly available documentation/source, without requesting private implementation details.
A link to an existing answer or the documented boundary would be appreciated.
OK, then I think you have a trade off to make. There are ways you can limit the resources used by your test but:
- They are not as simple as enabling a few options. You’ll have to write a bunch of complex code.
- Once you’ve done that, it won’t be perfect. For example, you might be able to limit the resources used by your test process, but what happens if your test using
NSWorkspaceto launch a bazillion copies some heavyweight app? There’s no good way to stop that.
For more background on this, see my reply here.
Now, if you were planning to deploy this to customers then maybe it might be worth doing this extra work. But it’s not clear that doing it purely for the benefit of your tests is a reasonable choice.
One alternative is to run these tests within a VM, where you can reasonably limit the impact of the VM as a whole.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"