Possible memory leak in polynomial evaluation

asked 2019-11-18 06:45:46 -0500

fabio_fc gravatar image

Hello,

if I execute this code in SageMath 8.9

RRR = RealField(prec = 165)
P = PolynomialRing(RRR,'x')
g = P([1..55])
gpi = RRR.pi()
ME = 32
c = 1.5
gamma = 0.5
disk = [cos(2*gpi*i/ME)+I*sin(2*gpi*i/ME) for i in range(ME)]
ellipse = [gamma*(w+c^2/(4*gamma^2)/w) for w in disk]
while (true):
  max([abs(g(x=z)) for z in ellipse])
  print "memory usage: " + str(get_memory_usage())

I see that the memory usage increases as time goes by. On the other hand, if I substitute the expression for ellipse with something like [1..ME], I don't see an increment in memory anymore. Is it a normal behaviour?

edit retag flag offensive close merge delete