Text of developer.apple.com › forums › thread › 856401 as Styx crawled it on Nov 20, 2026. The page may have changed since. Only its words are kept, without pictures or layout.

Open the live page

RLIMIT_AS across posix_spawn and e… | Apple Developer Forums

RLIMIT_AS across posix_spawn and exec on Apple silicon: documented guarantees? App & System Services Core OS macOS You’re now watching this thread. If you’ve opted in to email or web notifications, you’ll be notified when there’s activity. Click again to stop watching or visit your profile to manage watched threads and notifications. You’ve stopped watching this thread and will no longer receive emails or web notifications when there’s activity.

Click again to start watching. WhiteRabbit88 OP Created 1w Replies 5 Boosts 0 Views 252 Participants 2 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. Answered by DTS Engineer in 916183022 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 NSWorkspace to 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" Replies 5 Boosts 0 Views 252 Participants 2 DTS Engineer OP Apple 1w What high-level goal are you trying to achieve here?

Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = "eskimo" + "1" + "@" + "apple.com" Add comment WhiteRabbit88 OP 1w Thanks, Quinn. Our high-level goal is to run local tests of our application’s draft-deletion and backup/restore workflows safely on a Mac with Apple silicon. Each test run should operate on disposable test data, have bounded resource usage, and terminate cleanly if it exceeds its budget.

We want to keep the host responsive and protect the main application and real user data. These are tests of our own application code. The tests may launch a runtime and child processes. The memory-specific concern is preventing a faulty or runaway test from exhausting the host’s memory, including during process startup and subsequent exec transitions. We were investigating RLIMIT_AS as a possible mechanism. What supported macOS API or isolation architecture would you recommend for this goal, and what memory-containment guarantees and limitations should we design around?

We’re looking for guidance on a supported approach; publicly documented guarantees or limitations would be sufficient. Add comment DTS Engineer OP Apple 1w Written by WhiteRabbit88 in 915678022 Our high-level goal is to run local tests of our application’s draft-deletion and backup/restore workflows So you only need this for you test infrastructure? Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = "eskimo" + "1" + "@" + "apple.com" Add comment WhiteRabbit88 OP 1w Yes — specifically for our local development and test infrastructure.

We control the test runner and the application code being tested. The goal is to contain a faulty or runaway test so it cannot exhaust resources on the development Mac. We can evaluate a separate test environment if that is the approach you recommend. Add comment DTS Engineer OP Apple 1w Recommended 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 NSWorkspace to 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" Add comment