@greglucas mentioned that he is interested in moving the macOS backend to ARC. This was previously attempted in #23060, caused a crash in #23653, and reverted in #23654.
After my memory-management PR lands, enabling ARC should be relatively straightforward.
The one issue is that we store Obj-C objects into C structs (allocated by tp_alloc). Support for ARC objects in C structs wasn't added until macOS 10.14 / Xcode 10. We support compiling on macOS 10.12.
Additionally, even if we changed our minimum macOS to 10.14, we would need to ensure that tp_alloc guarantees zero-filled memory to be compatible with the Xcode 10 feature.
In the meantime, we will have to use an __unsafe_unretained attribute on the objects in our C structs, and manually retain/release them.
Adding this comment mostly for my own future reference.
WWDC 2018 Session 409 explains the "ARC in C Structs" feature added in Xcode 10. Apple likes to remove old WWDC videos, so here's links to the Archived Video (warning, 1.3GB download) and Archived Slides.
Activity
iccir commented on May 31, 2026
Adding this comment mostly for my own future reference.
WWDC 2018 Session 409 explains the "ARC in C Structs" feature added in Xcode 10. Apple likes to remove old WWDC videos, so here's links to the Archived Video (warning, 1.3GB download) and Archived Slides.