On my machine, an example like this results in a leak:
aut = spot.translate(spot.formula('(F(p & X(p & Xh)) & G((!h | Xp) &
(!m |
X!p))) | (F(h & X!p) & G((!m | X!p) & (!p | X(!p | X!h))))'))
for i in range(100):
newaut = spot.automaton(aut.to_str())
for i in range(0, 10):
for t in newaut.out(i):
pass
del newaut
print(resource.getrusage(resource.RUSAGE_SELF).ru_maxrss)
Indeed, the out_iteraser method is really a bit inconvenient to use ; )
On Fri, Jan 28, 2022 at 5:58 PM Alexandre Duret-Lutz <adl(a)lrde.epita.fr>
wrote:
Yechuan Xia <xiaozi465(a)gmail.com> writes:
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).
Please provide a small example to reproduce the problem so it can be
fixed. What you describe sound unexpected.
Adding
for i in newaut.out(0):
pass
to my previous example does not leak.
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.
out_iteraser does not follow C++'s and Python's convention for
iteration, so it is a bit cumbersome to use. There are very few cases
where out_iteraser() is needed.