Skip to content

Commit

Permalink
Fix memory leak (#64)
Browse files Browse the repository at this point in the history
* fix memory leak on behalf of NWPathMonitor instanace

* fix BeaconFlusher memory leak

* restore disapatchGroup.notify closure handling

* bump version to 1.8.6
  • Loading branch information
Hongyan Jiang authored and GitHub Enterprise committed Nov 27, 2024
1 parent ec6f2a6 commit 485d454
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 8 deletions.
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 1.8.6
- fix memory leak

## 1.8.5
- detect Application Not Responding scenario
- remove code for iOS versions lower than 12
Expand Down
2 changes: 1 addition & 1 deletion InstanaAgent.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
#

s.name = "InstanaAgent"
s.version = "1.8.5"
s.version = "1.8.6"
s.summary = "Instana iOS agent."

# This description is used to generate tags and improve search results.
Expand Down
7 changes: 3 additions & 4 deletions Sources/InstanaAgent/Beacons/BeaconFlusher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,12 @@ class BeaconFlusher {
disapatchGroup.leave()
return
}
send(request) { [weak self] sentResult in
guard let self = self else { return }
send(request) { [weak self, capturedBeacons = beaconBatch] sentResult in
switch sentResult {
case .success:
self.sentBeacons.formUnion(beaconBatch)
self?.sentBeacons.formUnion(capturedBeacons)
case let .failure(error):
self.errors.append(error)
self?.errors.append(error)
}
disapatchGroup.leave()
}
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion Sources/InstanaAgent/Configuration/VersionConfig.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
struct VersionConfig {
static let agentVersion = "1.8.5"
static let agentVersion = "1.8.6"
}
2 changes: 1 addition & 1 deletion Sources/InstanaAgent/Utils/Networking/NetworkUtility.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Foundation
import Network

class NetworkUtility {
let nwPathMonitor = NWPathMonitor()
var connectionType: ConnectionType = .undetermined {
didSet {
if oldValue != .undetermined {
Expand All @@ -20,7 +21,6 @@ class NetworkUtility {

init(observeNetworkChanges: Bool = true) {
if #available(iOS 12.0, *) {
let nwPathMonitor = NWPathMonitor()
nwPathMonitor.pathUpdateHandler = { path in
if path.usesInterfaceType(.wifi) {
self.update(.wifi)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class InstanaSystemUtilsTests: InstanaTestCase {

func test_AgentVersion() {
// Then
AssertTrue(InstanaSystemUtils.agentVersion == "1.8.5")
AssertTrue(InstanaSystemUtils.agentVersion == "1.8.6")
}

func test_systemVersion() {
Expand Down

0 comments on commit 485d454

Please sign in to comment.