Skip to content

Commit fd1971c

Browse files
authored
Add the call of DropKids at the end of executor.Run to delete the local 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.
1 parent 99acf1d commit fd1971c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

paddle/fluid/framework/executor.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,12 @@ void Executor::RunPreparedContext(ExecutorPrepareContext* ctx, Scope* scope,
348348
}
349349
}
350350
}
351+
platform::DeviceContextPool::Instance().Get(place_)->Wait();
351352
if (create_vars && create_local_scope) {
352353
scope->DeleteScope(local_scope);
354+
} else {
355+
// Delete the local scopes created in operators.
356+
scope->DropKids();
353357
}
354358
if (FLAGS_benchmark) {
355359
VLOG(2) << "-------------------------------------------------------";

0 commit comments

Comments
 (0)