fix: Memory leaks in SimpleWebTransport#4098
fix: Memory leaks in SimpleWebTransport#4098liamcary wants to merge 5 commits intoMirrorNetworking:masterfrom
Conversation
| try | ||
| { | ||
| receiveThread.Interrupt(); | ||
| } | ||
| catch (Exception e) | ||
| { | ||
| Log.Exception("[SWT-Connection] receiveThread.Interrupt", e); | ||
| } |
There was a problem hiding this comment.
Have you seen Thread.Interrupt throw? I dont think SecurityException should ever be thrown in unity/mono or with the way we use it, because we both create and interrupt the thread there should be no permission issue
There was a problem hiding this comment.
I haven't, but i added it to be safe in case its extremely rare, or happens on windows but not linux, etc. Theoretically, security permission exceptions would have thrown earlier, when starting the thread. It's critical that Dispose continues executing, so i think its a good policy to handle every possible exception, even if it just serves as a reminder to people editing Dispose() in future. For these changes I just went to the docs for each method and added exception handling for methods that have any documented exceptions, and removed exception handling for those that don't.



Handle several edge cases where ArrayBuffers were taken from the buffer pool but potentially not returned. Also handle exceptions to prevent Connection.Dispose exiting before releasing sendQueue.