There is a memory leak in the evaluation of multivariable polynomials:

-C.<x,y,z>=GF(2)[]
-f=x^4+x*y^3+z^6

-get_memory_usage()
.....1014.47265625
- for i in xrange(1000000):
    a=f(1,0,0)
-get_memory_usage()
.....1052.47265625

I think the problem is in the implementation of the __call__ method in 
rings/polynomials/multi_polynomial_element.py . It has:

 def __call__(self,*x,**kwds): 

[...]

 try:
    K = x[0].parent()
  except AttributeError:
    K = self.parent().base_ring()
  y = K(0)
  for (m,c) in self.element().dict().iteritems():
     y += c*misc.mul([ x[i]**m[i] for i in range(n) if m[i] != 0])
  return y

So in every loop a new ring K is created and saved

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to