Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(761)

Unified Diff: src/js/harmony-async-await.js

Issue 2334323006: Fix async/await memory leak (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/harmony/async-await-loop.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/harmony-async-await.js
diff --git a/src/js/harmony-async-await.js b/src/js/harmony-async-await.js
index 0d470bbe8c84300dfcd9213ba1becb016294bd40..0f66c57f4d97e29912cdbef9d10b5cca5f2e22eb 100644
--- a/src/js/harmony-async-await.js
+++ b/src/js/harmony-async-await.js
@@ -67,8 +67,14 @@ function AsyncFunctionAwait(generator, awaited, outerPromise) {
// );
var promise = PromiseCastResolved(awaited);
- var onFulfilled =
- (sentValue) => %_Call(AsyncFunctionNext, generator, sentValue);
+ var onFulfilled = (sentValue) => {
+ %_Call(AsyncFunctionNext, generator, sentValue);
+ // The resulting Promise is a throwaway, so it doesn't matter what it
caitp 2016/09/15 20:18:40 don't we have this same problem in the rejection c
Dan Ehrenberg 2016/09/15 20:24:21 I don't think so; we don't have the whole chaining
caitp 2016/09/15 20:32:23 Either way, I think it would still be good to add
Dan Ehrenberg 2016/09/15 20:37:58 Oh, you're actually right. It'd similarly take kee
+ // resolves to. What is important is that we don't end up keeping the
+ // whole chain of intermediate Promises alive by returning the value
+ // of AsyncFunctionNext, as that would create a memory leak.
+ return UNDEFINED;
+ };
var onRejected =
(sentError) => %_Call(AsyncFunctionThrow, generator, sentError);
« no previous file with comments | « no previous file | test/mjsunit/harmony/async-await-loop.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698