Skip to content
Snippets Groups Projects
Commit 0691b46d authored by Christoph Groth's avatar Christoph Groth
Browse files

work around memory leak in scipy.sparse.linalg

parent c634b48d
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,20 @@ import scipy.sparse as sp
import scipy.sparse.linalg as spl
from kwant import physics, system
# This patches a memory leak in scipy:
# http://projects.scipy.org/scipy/ticket/1597
#
# TODO: Remove this code once it is likely that the official bug fix has
# reached all of our users.
def del_for_umfpackcontext(self):
self.free()
try:
if not hasattr(spl.dsolve.umfpack.UmfpackContext, '__del__'):
spl.dsolve.umfpack.UmfpackContext.__del__ = del_for_umfpackcontext
except:
pass
del del_for_umfpackcontext
def make_linear_sys(sys, out_leads, in_leads, energy=0,
force_realspace=False):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment