Skip to content

retain loops #95

Open
Open
@wtholliday

Description

@wtholliday

In AudioKitSynthOne/Manager/Manager+callbacks.swift, retain loops are created by the callbacks. Search for callback = { in your codebase and you'll find more.

The callbacks need to be of the form

myWidget.callback = { [weak self] in
   guard let strongSelf = self else { return }
  // do stuff with strongSelf
}

This isn't a big deal for a stand-alone app (though, it's considered bad form), but if you ever want to make an AudioUnit Extension, the leaks will become an issue.

Timers are also a source of retain loops, as well as simply creating cycles between view controllers, etc.

You can use Xcode's Memory Graph Debugger to find them, though it's still not very easy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions