Skip to content

Commit 485d454

Browse files
Hongyan JiangGitHub Enterprise
authored andcommitted
Fix memory leak (#64)
* fix memory leak on behalf of NWPathMonitor instanace * fix BeaconFlusher memory leak * restore disapatchGroup.notify closure handling * bump version to 1.8.6
1 parent ec6f2a6 commit 485d454

File tree

7 files changed

+10
-8
lines changed

7 files changed

+10
-8
lines changed

Changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 1.8.6
4+
- fix memory leak
5+
36
## 1.8.5
47
- detect Application Not Responding scenario
58
- remove code for iOS versions lower than 12

InstanaAgent.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
#
1717

1818
s.name = "InstanaAgent"
19-
s.version = "1.8.5"
19+
s.version = "1.8.6"
2020
s.summary = "Instana iOS agent."
2121

2222
# This description is used to generate tags and improve search results.

Sources/InstanaAgent/Beacons/BeaconFlusher.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,12 @@ class BeaconFlusher {
107107
disapatchGroup.leave()
108108
return
109109
}
110-
send(request) { [weak self] sentResult in
111-
guard let self = self else { return }
110+
send(request) { [weak self, capturedBeacons = beaconBatch] sentResult in
112111
switch sentResult {
113112
case .success:
114-
self.sentBeacons.formUnion(beaconBatch)
113+
self?.sentBeacons.formUnion(capturedBeacons)
115114
case let .failure(error):
116-
self.errors.append(error)
115+
self?.errors.append(error)
117116
}
118117
disapatchGroup.leave()
119118
}

Sources/InstanaAgent/Beacons/HJFakeFlusher.swift

Whitespace-only changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
struct VersionConfig {
2-
static let agentVersion = "1.8.5"
2+
static let agentVersion = "1.8.6"
33
}

Sources/InstanaAgent/Utils/Networking/NetworkUtility.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import Foundation
77
import Network
88

99
class NetworkUtility {
10+
let nwPathMonitor = NWPathMonitor()
1011
var connectionType: ConnectionType = .undetermined {
1112
didSet {
1213
if oldValue != .undetermined {
@@ -20,7 +21,6 @@ class NetworkUtility {
2021

2122
init(observeNetworkChanges: Bool = true) {
2223
if #available(iOS 12.0, *) {
23-
let nwPathMonitor = NWPathMonitor()
2424
nwPathMonitor.pathUpdateHandler = { path in
2525
if path.usesInterfaceType(.wifi) {
2626
self.update(.wifi)

Tests/InstanaAgentTests/Configuration/InstanaSystemUtilsTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class InstanaSystemUtilsTests: InstanaTestCase {
55

66
func test_AgentVersion() {
77
// Then
8-
AssertTrue(InstanaSystemUtils.agentVersion == "1.8.5")
8+
AssertTrue(InstanaSystemUtils.agentVersion == "1.8.6")
99
}
1010

1111
func test_systemVersion() {

0 commit comments

Comments
 (0)