From 499b27d7566d39dab3bbe1b6f1886967637a879e Mon Sep 17 00:00:00 2001 From: Maciek Grzybowski Date: Thu, 16 Jul 2020 18:16:43 +0200 Subject: [PATCH 1/2] RUMM-610 Optimize memory usage when doing intensive logging --- Sources/Datadog/Core/Persistence/FilesOrchestrator.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Sources/Datadog/Core/Persistence/FilesOrchestrator.swift b/Sources/Datadog/Core/Persistence/FilesOrchestrator.swift index a95c883c7f..e80dedcbd6 100644 --- a/Sources/Datadog/Core/Persistence/FilesOrchestrator.swift +++ b/Sources/Datadog/Core/Persistence/FilesOrchestrator.swift @@ -65,14 +65,18 @@ internal class FilesOrchestrator { throw InternalError(description: "data exceeds the maximum size of \(writeConditions.maxWriteSize) bytes.") } - try purgeFilesDirectoryIfNeeded() - let lastWritableFileOrNil = reuseLastWritableFileIfPossible(writeSize: writeSize) if let lastWritableFile = lastWritableFileOrNil { // if last writable file can be reused lastWritableFileUsesCount += 1 return lastWritableFile } else { + // NOTE: RUMM-610 As purging files directory is a memory-expensive operation, do it only when we know + // that a new file will be created. With SDK's `PerformancePreset` this gives + // the process enough time to not over-allocate internal `_FileCache` and `_NSFastEnumerationEnumerator` + // objects, resulting with a flat allocations graph in a long term. + try purgeFilesDirectoryIfNeeded() + let newFileName = fileNameFrom(fileCreationDate: dateProvider.currentDate()) let newFile = try directory.createFile(named: newFileName) lastWritableFileName = newFile.name From 122bc4248c69b95e24ddf14f85853411d5f43658 Mon Sep 17 00:00:00 2001 From: Maciek Grzybowski Date: Fri, 17 Jul 2020 14:44:34 +0200 Subject: [PATCH 2/2] RUMM-610 Bump the hotfix version --- DatadogSDK.podspec | 2 +- DatadogSDKObjc.podspec | 2 +- Sources/Datadog/Datadog.swift | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DatadogSDK.podspec b/DatadogSDK.podspec index 7f8b7c4f3f..ea7a3fa6cd 100644 --- a/DatadogSDK.podspec +++ b/DatadogSDK.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "DatadogSDK" s.module_name = "Datadog" - s.version = "1.2.3" + s.version = "1.2.4" s.summary = "Official Datadog Swift SDK for iOS." s.homepage = "https://www.datadoghq.com" diff --git a/DatadogSDKObjc.podspec b/DatadogSDKObjc.podspec index c9ff8271e5..c5c5dd8187 100644 --- a/DatadogSDKObjc.podspec +++ b/DatadogSDKObjc.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "DatadogSDKObjc" s.module_name = "DatadogObjc" - s.version = "1.2.3" + s.version = "1.2.4" s.summary = "Official Datadog Objective-C SDK for iOS." s.homepage = "https://www.datadoghq.com" diff --git a/Sources/Datadog/Datadog.swift b/Sources/Datadog/Datadog.swift index f0560431a5..08ed951eea 100644 --- a/Sources/Datadog/Datadog.swift +++ b/Sources/Datadog/Datadog.swift @@ -8,7 +8,7 @@ import Foundation /// SDK version associated with logs. /// Should be synced with SDK releases. -internal let sdkVersion = "1.2.3" +internal let sdkVersion = "1.2.4" /// Datadog SDK configuration object. public class Datadog {