Yechuan Xia <xiaozi465@gmail.com> writes:
> Hi, I'm building some automatons using spot's python interface.
> Simply, codes like:
>
> for i in n:
> temp_aut = spot.automaton(aut.to_str()) # copy an automaton
> ...something
> del temp_aut
>
> But I found that whenever it enters a new loop, the memory of the
> automaton assigned to temp_aut is not freed. And it leads to a memory
> overflow.
>
> I thought this might be solved with 'delete temp_aut' in the C++
> version spot, but in the python interface 'del temp' doesn't seem to
> work.
Using "del temp_aut", or "temp_aut = None" should cause the automaton's
destructor to be called, unless "...something" stores are reference to
that automaton somewhere.
Can you provide a test-case that demonstrates the problem?
I can't reproduce it from your example, trying something like:
for i in range(100):
newaut = spot.automaton(aut.to_str())
del newaut
print(resource.getrusage(resource.RUSAGE_SELF).ru_maxrss)
I see that ru_maxrss is not growing.