aliyun / aliyun-oss-ios-sdk

iOS SDK for aliyun object storage service
Other
469 stars 321 forks source link

使用 流式下载大文件时,内存依然不释放,下载超大文件时,直接内存溢出 #339

Open topws opened 2 years ago

topws commented 2 years ago

let request = OSSGetObjectRequest() request.bucketName = unpackedConfig.bucket request.objectKey = path request.downloadProgress = downloadProgress

    request.onRecieveData = { data in
        fileHandle?.seekToEndOfFile()
        fileHandle?.write(data)
    }

    let getTask = unpackedClient.getObject(request)
    getTask.continue({ task in
        fileHandle?.closeFile()

        if let error = task.error {
            completion?(nil, error)
        } else {
            completion?(downloadToFileURL.path, nil)
        }
        return nil
    }, cancellationToken: nil)