* @brief Implementation of @c limitSystemMemory() on MacOS. */
| 115 | * @brief Implementation of @c limitSystemMemory() on MacOS. |
| 116 | */ |
| 117 | bool limitSystemMemoryOnMacOS(std::size_t limit) { |
| 118 | // Warning: We can't limit memory on macOS. Before macOS 12, |
| 119 | // limitSystemMemoryOnPOSIX() does not actually do anything on macOS (it |
| 120 | // just succeeds). Since macOS 12, it returns an error and RetDec cannot |
| 121 | // start. For more details, see |
| 122 | // - https://github.com/avast/retdec/issues/379 |
| 123 | // - https://github.com/avast/retdec/issues/1045 |
| 124 | // |
| 125 | // To be honest, Apple can control memmory limit via a so-called ledger() |
| 126 | // system call which is private. An old version which was opened to |
| 127 | // OpenSource (from 10.9-10.10?) used setrlimit() but at some point |
| 128 | // setrlimit() was broken and not ledger(). Probably in macOS 12 |
| 129 | // setrlimit() was completely broken. |
| 130 | // |
| 131 | // Since we do not have any other way of limiting the memory on macOS, just |
| 132 | // return true. |
| 133 | return true; |
| 134 | } |
| 135 | |
| 136 | #elif defined(OS_BSD) |
| 137 |