From e09803c525b43c6aa781f0282be4b5ed479b5f7f Mon Sep 17 00:00:00 2001 From: xiongkun Date: Tue, 7 Jun 2022 12:09:40 +0800 Subject: [PATCH] fix memory leakage (#43141) (#43220) --- .../fluid/dygraph/dygraph_to_static/program_translator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/paddle/fluid/dygraph/dygraph_to_static/program_translator.py b/python/paddle/fluid/dygraph/dygraph_to_static/program_translator.py index b860740f71b..aed482e4b22 100644 --- a/python/paddle/fluid/dygraph/dygraph_to_static/program_translator.py +++ b/python/paddle/fluid/dygraph/dygraph_to_static/program_translator.py @@ -61,7 +61,7 @@ class FunctionCache(object): def __init__(self): # Caches the converted static functions. {dygraph_func: static_func} - self._converted_static_func_caches = dict() + self._converted_static_func_caches = weakref.WeakKeyDictionary() # Caches the converted ast node for same source code. {source_code: ast_root} self._code_to_ast_caches = dict() self._dygraph_to_static = DygraphToStaticAst() -- GitLab