On macOS 11, Rosetta2 apparently caches translated programs and shared libraries under /var/db/oah
.
On an M1-based CI instance where we are testing per-commit-novel x86_64 binaries under Rosetta2, this directory seems to grow without bound and eventually ends up consuming all free disk space on the machine. Currently /var/db/oah
is approximately 800GB and contains about 2.4 million directories.
I would have hoped that such a cache would have a size limit and built-in LRU behavior, or at least some sort of administrative command to prune it (perhaps based on atime?) that could be scheduled, but so far I've been unable to find any setting to configure such a bound for the cache or any command to interact with it at all, let alone clean it out. Ideally, we would like to not inhibit caching or remove recently used translations since we do expect that caching will offer a performance benefit when the same binary is re-used, which does happen in our testing environment.
Is anyone aware of any tooling or system configuration settings that may allow us to bound the size of the oah
cache for Rosetta2, or manually prune it, or if necessary disable caching entirely?
cron
job is our option of last resort, but the question is whether there are any built-in controls provided by the OS to bound the cache (first preference), or tooling that already understands the cache that we can leverage in such a cron job (second preference), before we need to go and write our own from scratch. It seems very strange that Apple would allow this cache to grow without bound to the point of rendering the system unusable./var/db/oah
seems to be protected by SIP. More out of curiosity (and partially because it impacts your ability to usecron
): Have you disabled SIP on the CI machine?