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

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 11806003: Fix context chaining to prevent memory leak (issue 7681). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 | runtime/vm/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_builder.cc
===================================================================
--- runtime/vm/flow_graph_builder.cc (revision 16755)
+++ runtime/vm/flow_graph_builder.cc (working copy)
@@ -2622,9 +2622,11 @@
num_context_variables));
// If this node_sequence is the body of the function being compiled, and if
- // this function is not a closure, do not link the current context as the
- // parent of the newly allocated context, as it is not accessible. Instead,
- // save it in a pre-allocated variable and restore it on exit.
+ // this function allocates context variables, but none of its enclosing
+ // functions do, the context on entry is not linked as parent of the
+ // allocated context but saved on entry and restored on exit as to prevent
+ // memory leaks.
+ // In this case, the parser pre-allocates a variable to save the context.
if (MustSaveRestoreContext(node)) {
Value* current_context = Bind(new CurrentContextInstr());
Do(BuildStoreTemp(*owner()->parsed_function().saved_context_var(),
« no previous file with comments | « no previous file | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698