4 ms·
macOS is (a) Unix (officially even!) and inherits many of its features and issues. To Apple's credit though they seem to be using a memory-safe language (Swift
by musicale 1y ago
macOS is (a) Unix (officially even!) and inherits many of its features and issues.
To Apple's credit though they seem to be using a memory-safe language (Swift) for new code and libraries (at least at user level) and may be rewriting old code as well, and they have also added MIE/EMTE to Apple Silicon. They also ship clang/clang++ with support for -fbounds-safety and -fsanitize=address.
Objective-C also supports Automatic Reference Counting, which helps with memory management. (Apple also implemented a garbage collector for Objective-C 2.0, but abandoned it in favor of ARC. I am aware that reference counting is technically a form of garbage collection.)
- pjmlp 1y agoThe reason being, as can be seen on the archives, the conservative tracing GC had several gotchas to work with existing code, thus segfaults were common. The way ARC works in Objective-C, by automating retain/release call patterns already required by existing frameworks was much safer to implement, without such crashes. Similar to all those C++ smart pointers automating COM reference counting.