Commit a6e8fe6c by Tianqi Chen Committed by GitHub

[FFI] Fix global free destruction (#985)

parent e374abf8
......@@ -165,7 +165,7 @@ class FunctionBase(object):
self.is_global = is_global
def __del__(self):
if not self.is_global:
if not self.is_global and _LIB is not None:
check_call(_LIB.TVMFuncFree(self.handle))
def __call__(self, *args):
......
......@@ -44,7 +44,8 @@ class NodeBase(object):
self.handle = handle
def __del__(self):
check_call(_LIB.TVMNodeFree(self.handle))
if _LIB is not None:
check_call(_LIB.TVMNodeFree(self.handle))
def __getattr__(self, name):
ret_val = TVMValue()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment