Registering AWSS3 configuration creating 5000+ memory leaks

Viewed 307

I've been trying to figure out for the past two days why this simple setting up of a AWSS3 configuration could possibly create 5000+ memory leaks. This is the the code I have running in AppDelegate:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    // SetUp AWS Config
    let myIdentityPoolId = Constants.AWS_IDENTITY_POOL_ID
    let credentialsProvider: AWSCognitoCredentialsProvider = AWSCognitoCredentialsProvider(regionType: .USWest2,
                                                                                           identityPoolId: myIdentityPoolId)
    if let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider:credentialsProvider) {
        AWSS3.register(with: configuration, forKey: "defaultKey")
    }

    return AWSMobileClient.sharedInstance().interceptApplication(application,
                                                                 didFinishLaunchingWithOptions: launchOptions)
}

Using Instruments, I've tested removing all the code I shared (except for the return AWSMobileClient.sharedInstance().interceptApplication) and found that I get no memory leaks, but as soon as I add it back I end up with all the leaks... What gives?

If it helps, I'm wanting to list the objects of my AWS bucket which works with the following code:

 let listRequest: AWSS3ListObjectsRequest = AWSS3ListObjectsRequest()
    let s3 = AWSS3.s3(forKey: "defaultKey")

    listRequest.bucket = Constants.AWS_BUCKET
    listRequest.prefix = Constants.SPECIAL_PREFIX

    s3.listObjects(listRequest).continueWith { (task) -> AnyObject? in
}

Am I making an obvious mistakes?

enter image description here

1 Answers

If your app can work with these leaks then you can just file a bug here and wait for the fixes.

It seems they are inheriting these leaks since long time as you can see here and here. This issue S3 multipart upload memory leak is still open and marked as a bug so you need to wait until these are fixed.

Related