diff --git a/src/framework/scope.h b/src/framework/scope.h index 4193db30e4bb487a323a188a95e4e8bf156549d9..f1495761c938d3d73e17d1ee01b6a6512ff8e6a8 100644 --- a/src/framework/scope.h +++ b/src/framework/scope.h @@ -32,7 +32,16 @@ class Scope { Scope() = default; ~Scope() { - DropKids(); + for (auto &var : vars_) { + DropKids(); + delete var.second; + } + vars_.clear(); + for (auto kid : kids_) { + delete kid; + } + kids_.clear(); + #ifdef PADDLE_MOBILE_CL delete cl_scope_; #endif