From a028e01acc5ef32c0f4933c4f56d645d64b36500 Mon Sep 17 00:00:00 2001 From: Yury Niakhai <80161944+YuryNiakhai@users.noreply.github.com> Date: Wed, 17 Jan 2024 15:20:01 +0200 Subject: [PATCH] fix memory leak --- Sources/SignalRClient/DefaultHttpClient.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/SignalRClient/DefaultHttpClient.swift b/Sources/SignalRClient/DefaultHttpClient.swift index 13edcec..daee66d 100644 --- a/Sources/SignalRClient/DefaultHttpClient.swift +++ b/Sources/SignalRClient/DefaultHttpClient.swift @@ -24,6 +24,10 @@ class DefaultHttpClient: HttpClientProtocol { ) } + deinit { + session.finishTasksAndInvalidate() + } + func get(url: URL, completionHandler: @escaping (HttpResponse?, Error?) -> Void) { sendHttpRequest(url:url, method: "GET", body: nil, completionHandler: completionHandler) }