-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When a Branch object gets instantiated whether through the app's delegate initSession call or when tracking an event, a memory leak is created. It's 100% reproducible and goes away as soon as I remove anything that creates a Branch instance.
Steps to reproduce
- Create a fresh project (e.g: new SwiftUI app) and import the Branch SDK via SPM
- Init a Branch instance
- Run the app on the simulator or a real device
- Wait for a few minutes for the leak to show up (for me the leak shows up after around 2.5 minutes)
import SwiftUI
import BranchSDK
class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
Branch.getInstance().initSession(launchOptions: launchOptions) { (params, error) in
print("Branch initSession completed")
}
return true
}
}
@main
struct MemoryLeakExampleApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate
var body: some Scene {
WindowGroup {
ContentView()
.onOpenURL(perform: { url in
Branch.getInstance().handleDeepLink(url)
})
}
}
}Expected behavior
I would expect no memory leak
SDK Version
3.10.0
XCode Version
16.2.0
Device
iPhone 13 Pro Max
OS
iOS 18.3.1
Additional Information/Context
No response
GaryLaurenceauAva, TarunBardawa and KeiroMidori
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working