Conversation
We were subscribing to the game.Exited event but we never unsubscribed, which meant that when we closed the game the Process object could not be garbage collected, thus every game restart would cause a memory leak in a new Process object. Although we never noticed, it is likely that 100 or more game restarts would have caused a performance issue and possibly even a bug in the script.
See description for previous commit - same applies here
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.
TFS + 3D
We were subscribing to the
game.Exitedevent but we never unsubscribed, which means that the ASL script object cannot be garbage collected until the process object is garbage collected. Although here in practice it (probably) doesn't cause a memory leak since as far as I know there is no case where the same process object is still alive while another ASL script object is created, it's still a bit dangerous because if (even in a future LiveSplit update) something references that process object, it will prevent the ASL script object from getting garbage collected as well.Also, the script wasn't actually removing time when the game isn't running (though GMP tells me it worked before, so perhaps a new LiveSplit feature broke it?). For TFS this didn't matter because the other LRT conditions were already sufficient to freeze the timer when the game isn't running. I don't know if this made a difference for PoP 3D. Either way it's been fixed now.
PoP1 Apple II
The reset condition that was based on the game not running was inefficient and also it wasn't working (perhaps also because of a LiveSplit update?). Instead of checking the process name string every cycle (which involves reading every character of a string, and potentially a system call), we now simply check if the process object itself has changed. This should add virtually no overhead.
All
resetblock with justreturn vars.OldProcess != vars.CurrentProcessto verify that that part of the script works correctly (since the other reset conditions may obscure whether this condition works or not)