On Friday, February 9, 2018 at 11:03:11 AM UTC, Marco Caliari wrote:
Hi, the following script
def test(m,c,precision):
M = 3*m
RRR = RealField(prec = precision)
coef02 = [RRR(1/i) for i in [1..M+1]]
g = coef02[M]
for i in [M-1..2,step=-1]:
g = x*g+coef02[i]
ME = 32
disk = [exp (2*pi.n(precision)*I*i/ME) for i in range(ME)]
epsilon1 = max([abs(g(x=z)) for z in disk])
return
m = 40
for c in [1/2..10,step=1/2]:
for ell in [1..10]:
test(m,c,165)
Indeed, comparing the objects on the heap that weren't there before the loop I find:
[(<type 'builtin_function_or_method'>, 1),
(<type 'sage.rings.rational.Rational'>, 1),
(<type 'instancemethod'>, 1),
(<type 'set'>, 1),
(<type 'dict'>, 1),
(<type 'tuple'>, 3),
(<type 'list'>, 3),
(<type 'frame'>, 3),
(<type 'weakref'>, 28),
(<type 'sage.rings.real_mpfi.RealIntervalFieldElement'>, 6200),
(<type 'sage.rings.real_mpfr.RealNumber'>, 29999),
(<type 'sage.rings.complex_number.ComplexNumber'>, 1457000)]
The real numbers mostly seem to be approximations to pi. Using objgraph.show_backrefs I'm not getting anything useful. We're definitely leaking but I wasn't able to identify a cache that's keeping references. Is that any change that we're doing something wrong with an INCREF/DECREF ?