Skip to content

[MNT]: Re-enable Automatic Reference Counting (ARC) for macOS backend. #31797

@iccir

Description

@iccir

Summary

@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.

Proposed fix

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions