From 9963d9566ce7138c67ee6d84ee13454e36a3ebe7 Mon Sep 17 00:00:00 2001 From: jiaweizhuang Date: Sat, 3 Aug 2019 15:44:35 -0700 Subject: [PATCH] Free ESMF.Grid object to prevent small memory leak. Partially address https://github.com/JiaweiZhuang/xESMF/issues/53. --- xesmf/backend.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xesmf/backend.py b/xesmf/backend.py index 2fa8d96..80c46b2 100644 --- a/xesmf/backend.py +++ b/xesmf/backend.py @@ -306,11 +306,15 @@ def esmf_regrid_finalize(regrid): ''' + regrid.destroy() regrid.srcfield.destroy() regrid.dstfield.destroy() - regrid.destroy() + regrid.srcfield.grid.destroy() + regrid.dstfield.grid.destroy() # double check + assert regrid.finalized assert regrid.srcfield.finalized assert regrid.dstfield.finalized - assert regrid.finalized + assert regrid.srcfield.grid.finalized + assert regrid.dstfield.grid.finalized