fix: Memory leak in UnityTransport after StartClient failure#2518
Merged
simon-lemay-unity merged 4 commits intodevelopfrom Apr 19, 2023
Merged
fix: Memory leak in UnityTransport after StartClient failure#2518simon-lemay-unity merged 4 commits intodevelopfrom
simon-lemay-unity merged 4 commits intodevelopfrom
Conversation
NoelStephensUnity
approved these changes
Apr 19, 2023
Member
NoelStephensUnity
left a comment
There was a problem hiding this comment.
Looks good.
I thought I had added a test for the client failing with a bad address... but glad you caught that!
👍
johann-r-unity
approved these changes
Apr 19, 2023
0xFA11
approved these changes
Apr 19, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If
StartClientfailed, then the driver would not be created. But if the driver is not created, we exit early inShutdownwhich prevents us from disposing of the network settings and send queue (if any). This would result in a memory leak. The fix is simply to always dispose of these resources inShutdown, without guarding it with a check on the driver.One simple way to trigger that memory leak would be to start a client with an invalid IP address.
Changelog
UnityTransportthat occurred ifStartClientfailed.Testing and Documentation