From 126248acb35a0c199cd8d5057932738bdd52cdc1 Mon Sep 17 00:00:00 2001 From: xiongkun Date: Wed, 1 Jun 2022 21:46:31 +0800 Subject: [PATCH] fix memory leakage (#43141) --- .../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 2efb6965085..eac2941c097 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