Skip to content

☂️ Migrate iOS embedder objective-c code to ARC (Auto Reference Counting) #137801

Closed

Description

@cyanglaz

Most of the files in ios Embedder and some shared darwin codes use MRC(Manual Reference Counting).

Manual Reference Counting is easy to make memory management mistake with. Objecgtive-C with Manual Reference Counting is not pleasant to work with, often scaring away contributors.

Migrate all the objective-C code to ARC will boosts Flutter's stability on iOS and making contributing to Flutter iOS embedder more efficient.

This is an umbrella issue tracks all the work needs to be done to migrate the iOS embedder to ARC:

  1. Temporarily enable Objective-C smart pointers (scoped_nsobject, scoped_block etc) to work with both ARC and MRC.
  2. Migrate all Objective-C files to ARC.
  3. [iOS] Eliminate ARC __bridge casts where possible #155943
  4. Remove the support of Objective-C smart pointers

Activity

  1. added
    platform-iosiOS applications specifically
    engineflutter/engine related. See also e: labels.
    P1High-priority issues at the top of the work list
    fyi-engineFor the attention of Engine team
    team-iosOwned by iOS platform team
    on Nov 2, 2023
  2. chinmaygarde commented on Nov 6, 2023

    @chinmaygarde
    Contributor

    Is there a general issue for this that include macOS?

  3. cyanglaz commented on Nov 6, 2023

    @cyanglaz
    Author

    Is there a general issue for this that include macOS?

    macOS is already in ARC so I didn't create an issue for macOS. I can't think of any impact it could cause on macOS. Loop in @cbracken for might insights.

  4. cbracken commented on Nov 7, 2023

    @cbracken
    Member

    Correct -- we're already building with ARC for macOS. I can't remember if the shared code in '//flutter/platform/darwin/common' is built with ARC enabled or not.

  5. cbracken commented on Nov 7, 2023

    @cbracken
    Member
  6. 50 remaining items

  7. cbracken commented on Nov 17, 2024

    @cbracken
    Member

    Just realised I hadn't updated this in a while. The entire codebase, other than impeller, is migrated to ARC. ScopedBlock, scoped_nsobject, scoped_nsprotocol, etc. have all been deleted. Once impeller is migrated, I'll close this issue.

  8. chinmaygarde commented on Nov 18, 2024

    @chinmaygarde
    Contributor
  9. cbracken commented on Nov 18, 2024

    @cbracken
    Member

    Ah that's why I didn't spot it in the targets explicitly!

    Well... in that case, I think we're done. Just one more patch.

  10. cbracken commented on Nov 18, 2024

    @cbracken
    Member

    We should also make sure delegates pointers are all weak where necessary: #156222

  11. cbracken commented on Nov 18, 2024

    @cbracken
    Member

    DONE!

  12. github-actions commented on Dec 4, 2024

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  13. locked as resolved and limited conversation to collaborators on Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listengineflutter/engine related. See also e: labels.platform-iosiOS applications specificallyteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions