The following script demonstrates the memory leak. I have two vectors a, b and repeatedly compute their outer product C[i, j] = a[i] * b[j].
"""Repeatedly compute the outer product of two random vectors."""
import os
import random
import psutil
import pytaco
dim = 2000
iterations = 201
print_every = 40
a = pytaco.tensor([dim], pytaco.dense)
b = pytaco.tensor([dim], pytaco.dense)
for i in range(dim):
a.insert((i,), random.random())
b.insert((i,), random.random())
a.pack()
b.pack()
i, j = pytaco.get_index_vars(2)
for n in range(iterations):
C = pytaco.tensor([dim, dim], pytaco.dense)
C[i, j] = a[i] * b[j]
C.compile()
C.assemble()
C.compute()
if n % print_every == 0:
process = psutil.Process(os.getpid())
print(f"Iter. {n}, memory (bytes): {process.memory_info().rss:.2e}")
Here is the output, which shows that memory increases at each iteration:
Hi,
I ran into a memory leak when using
pytaco
(I am using commit2b8ece4c230a5f0f0a74bc6f48e28edfb6c1c95e
, the currentmaster
at the time of writing).The following script demonstrates the memory leak. I have two vectors
a, b
and repeatedly compute their outer productC[i, j] = a[i] * b[j]
.Here is the output, which shows that memory increases at each iteration:
I tried adding a
del C
, and aimport gc; gc.collect()
at the end of each iteration without success. Therefore I suspect the leak is in the C++ layer.Best, Felix