From 8fdfaa8464cbf80887db99f66a3b10315000e560 Mon Sep 17 00:00:00 2001 From: Xiaojie Wu Date: Sun, 28 Jul 2024 15:57:00 -0700 Subject: [PATCH] try to fix possible memory leak in libxc (#189) * try to fix possible memory leak in libxc * unchange example * unchange example * Update libxc.py --- gpu4pyscf/dft/libxc.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gpu4pyscf/dft/libxc.py b/gpu4pyscf/dft/libxc.py index 55f0cb7a..a1f06fad 100644 --- a/gpu4pyscf/dft/libxc.py +++ b/gpu4pyscf/dft/libxc.py @@ -78,7 +78,6 @@ class _xcfun(ctypes.Structure): _libxc.xc_func_init.argtypes = (_xc_func_p, ctypes.c_int, ctypes.c_int) _libxc.xc_func_end.argtypes = (_xc_func_p, ) _libxc.xc_func_free.argtypes = (_xc_func_p, ) - _libxc.xc_func_alloc() class XCfun: def __init__(self, xc, spin): @@ -100,9 +99,8 @@ def __init__(self, xc, spin): def __del__(self): if self.xc_func is None: return - # TODO: deallocate xc func - #_libxc.xc_func_end(self.xc_func) - #_libxc.xc_func_free(self.xc_func) + _libxc.xc_func_end(self.xc_func) + _libxc.xc_func_free(self.xc_func) def needs_laplacian(self): return dft.libxc.needs_laplacian(self.func_id)