Hello all,
I have a sample code from tvm offical site below. I want to build thousands of 
operators in the same process. But i found there is memory leak and the memory 
usage is increasing. I thought after the build of one operator was finished, 
the corresponding resource should be freed. Do you have any advice? Can i free 
memory manually after building a operator?
Thanks a lot in advance!

Sample code(env: tvm 0.6, ubuntu 18.04, python3.7.5):

`
import os, psutil
import tvm

def tvm_build():
n = 2
A = tvm.placeholder((n,), name='A')
B = tvm.placeholder((n,), name='B')
C = tvm.compute(A.shape, lambda *i: A(*i) + B(*i), name='C')
s = tvm.create_schedule(C.op)
m = tvm.lower(s, [A, B, C], name="test_add")
rt_mod = tvm.build(m, target="llvm")

def main():
process = psutil.Process(os.getpid())
for i in range(0, 1000):
tvm_build()
print('i='+str(i)+', Used Memory:', process.memory_info().rss / 1024 / 1024, 
'MB')
`





---
[Visit 
Topic](https://discuss.tvm.apache.org/t/memory-leak-how-to-free-memory-manually-after-building-a-operator-for-long-running-building-case/8037/1)
 to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click 
here](https://discuss.tvm.apache.org/email/unsubscribe/b9bf25f4ab4641f21b5b1dd142870a090bda4438a7a75197e6b3955a60a3643f).

Reply via email to