From 6f8a13a8fc7407a6339570495ea599edf3307805 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Fri, 11 Jan 2019 14:24:21 -0800 Subject: [PATCH] Fix a memory leak on each HTTP request made to ROS By default NSURLSession will keep itself alive indefinitely, and has to be explicitly told to delete itself after it completes all enqueued tasks. --- CHANGELOG.md | 14 ++++++++++++++ Realm/RLMNetworkClient.mm | 2 ++ 2 files changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72ec853c70..08b0e007b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +x.y.z Release notes (yyyy-MM-dd) +============================================================= +### Enhancements +* None. + +### Fixed +* Fix a memory leak whenever Realm makes a HTTP(s) request to the Realm Object + Server (since 3.8.0, Issue [#6058](https://github.com/realm/realm-cocoa/issues/6058)). + +### Compatibility +* File format: Generates Realms with format v9 (Reads and upgrades all previous formats) +* Realm Object Server: 3.11.0 or later. +* APIs are backwards compatible with all previous releases in the 3.x.y series. + 3.13.1 Release notes (2019-01-03) ============================================================= diff --git a/Realm/RLMNetworkClient.mm b/Realm/RLMNetworkClient.mm index db1f67afbf..4a1397c769 100644 --- a/Realm/RLMNetworkClient.mm +++ b/Realm/RLMNetworkClient.mm @@ -425,6 +425,8 @@ + (void)sendRequestToEndpoint:(RLMSyncServerEndpoint *)endpoint // Add the request to a task and start it [[session dataTaskWithRequest:request] resume]; + // Tell the session to destroy itself once it's done with the request + [session finishTasksAndInvalidate]; } @end