0

I am getting memory leak during migration using Realm (v1.0.2). My code looks like that:

        let config = Realm.Configuration(
        schemaVersion: 1,
        migrationBlock: { migration, oldSchemaVersion in
            // We haven’t migrated anything yet, so oldSchemaVersion == 0
            if (oldSchemaVersion < 1) {
                migration.enumerate(MyClassRealm.className(), { (oldObject, newObject) in

                    newObject!["remoteId"] = 0
                    newObject!["deleted"] = false
                    newObject!["dirty"] = true
                    newObject!["updated"] = 0
                })
            }
    })

    // Tell Realm to use this new configuration object for the default Realm
    Realm.Configuration.defaultConfiguration = config

    // Now that we've told Realm how to handle the schema change, opening the file
    // will automatically perform the migration
    do {
        let _ = try Realm()
    } catch {
        TSLog.error(error as NSError)
    }

Stack trace: enter image description here

Do you have any idea what is wrong?

Roman Barzyczak
  • 3,785
  • 1
  • 30
  • 44

1 Answers1

0

It's difficult to tell without symbols for the intermediate frames of the stack trace, but I suspect you're running into Realm Cocoa issue #2933, which appears to be a memory leak due to a bug in Swift's runtime libraries.

bdash
  • 18,110
  • 1
  • 59
  • 91