Skip to content

Commit

Permalink
Fix a memory leak on each HTTP request made to ROS
Browse files Browse the repository at this point in the history
By default NSURLSession will keep itself alive indefinitely, and has to be
explicitly told to delete itself after it completes all enqueued tasks.
  • Loading branch information
tgoyne committed Jan 14, 2019
1 parent 56afd03 commit f63a296
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
=============================================================

Expand Down
2 changes: 2 additions & 0 deletions Realm/RLMNetworkClient.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit f63a296

Please sign in to comment.