When using continued_fraction to compute denominators of continued fraction convergents, I'm encountering what seems to be a memory leak. I'm running SageMath 9.0 on Windows 10 64-bit. If I run the following,
for i in [2500000,..,2600000]:
if i%1000 == 0:
print(i);
print(get_memory_usage());
C = continued_fraction(sqrt(i));
C.denominator(100);
then I see memory usage steadily climbing as I iterate through the loop. On the other hand, if I initialize sqrt(i) as an algebraic number, memory usage is essentially stable:
for i in [2500000,..,2600000]:
if i%1000 == 0:
print(i);
print(get_memory_usage());
if sqrt(i) not in QQ:
K.<sqrti> = QuadraticField(i);
C = continued_fraction(sqrti);
C.denominator(100);