Open
Conversation
…original This stops a memory leak. The CallSite keeps a reference to Promise objects. This stops the Promise from being garbage collected, which stops asyncDestroy from being called.
- For each non-destroyed async context we store a `Trace` object in the global `traces` map. - A trace object contains an array of `NamedStack` objects. This is simply a pair of `asyncId` and `frames`. - Whenever a new async context is created we ask the trigger Trace to copy its `stacks` into the newly created Trace. - The final long stack trace is assembled only if needed. This means tracking `executionScopeInits` is not necessary because we can do the stack trace deduplication later. - Moved `equalCallSites` next to its caller, `extendFrames` - `equalCallSites` treats anonymous stack frames as equal
Whenever a promise resolves we copy the trigger `Trace.stacks` into the current async context's `Trace`. We also recursively copy it into all related Traces. This means any Error stacks that are extended from this point on will contain the new frames. Note this leaks lots of memory, see the next commit for some limits.
Owner
|
I don't really understand what is going on here. Care to explain? "Fix" is also rather subjective. Following the |
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.
Splitting #40 into multiple PRs for easier review.