From 56f37d49fa9b6edff151fb131ba32a050be147a5 Mon Sep 17 00:00:00 2001 From: zhangyang0701 Date: Thu, 21 Mar 2019 16:10:39 +0800 Subject: [PATCH] fix memory leakage problem --- src/framework/scope.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/framework/scope.h b/src/framework/scope.h index 4193db30e4..f1495761c9 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 -- GitLab