-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR focuses on fixing the memory leaks that remained after addressing the ones fixed by introducing `Promise.race()`, which were surprisingly non-zero in number. 1. The original "safe `Promise.race()`" implementation itself had a variation of the original leak, though it's super-understandable why it wasn't caught earlier. Specifically, the original version was tested by allocating bunches of objects which didn't have any references between them, so it was easy not to notice that there was (literally) one more than you'd expect when running the test to see if the new version leaked. In the case of this project, a single leak of the "wrong" race contender acts kind of like a trip-wire which then causes massive excess memory consumption (due to the nature of the links from each `LinkedEvent` to its next-event). 2. During investigation of the former, I ran across a bug in V8 which caused a leak but _only_ when you attach a debugger. But due to the nature of what was being leaked in this case (another case of a `LinkedEvent` which would then hold onto every subsequently-emitted event for the life of the process), it seemed worthwhile to work around the problem, which turned out not to be too awful to do. I left a big ole comment in the code explaining what's going on.
- Loading branch information
Showing
5 changed files
with
308 additions
and
52 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.