Skip to content

Commit

Permalink
Add the call of DropKids at the end of executor.Run to delete the loc…
Browse files Browse the repository at this point in the history
…al scopes created in operators (#10403)

* Add the call of DeleteScope to delete the memory of scope created by NewScope.

* Call DropKids at the end of executor.Run to delete all local scopes created in operators.
  • Loading branch information
Xreki authored May 7, 2018
1 parent 99acf1d commit fd1971c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions paddle/fluid/framework/executor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,12 @@ void Executor::RunPreparedContext(ExecutorPrepareContext* ctx, Scope* scope,
}
}
}
platform::DeviceContextPool::Instance().Get(place_)->Wait();
if (create_vars && create_local_scope) {
scope->DeleteScope(local_scope);
} else {
// Delete the local scopes created in operators.
scope->DropKids();
}
if (FLAGS_benchmark) {
VLOG(2) << "-------------------------------------------------------";
Expand Down

0 comments on commit fd1971c

Please sign in to comment.