
Thank you for your reply! And I've found that it's not the memory of the automaton not being freed, but the containers acquired by 'aut.out(i)' not being freed in '...something'. This problem can be solved by using aut.out_iteraser(i). So I'm just wondering why there are two methods for getting out edges, and aut.out(i) doesn't allow erasure? And it seems that the aut.out(i) method is used by default in the spot's code examples. On Fri, Jan 28, 2022 at 12:30 AM Alexandre Duret-Lutz <adl@lrde.epita.fr> wrote:
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.