4 ms·
AFAIK, most of windows and OSX (and iOS) are in memory unsafe languages as well (c, c++, and objective c)
by thayne 1y ago
AFAIK, most of windows and OSX (and iOS) are in memory unsafe languages as well (c, c++, and objective c)
- musicale 1y agomacOS 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.
- pjmlp 1y agoStill, the keyword is still. Hence why Objective-C got GC, after its failure to play well with C semantics, got replaced with ARC, and afterwards Swift came to be. Microsoft now has a new policy in place, via the Secure Future Initiative, that only exiting code bases should be kept in C and C++, all new projects are to either use managed languages or Rust.