Ask Your Question

fabio_fc's profile - activity

2023-09-22 14:34:21 +0200 received badge  Notable Question (source)
2023-09-22 14:34:21 +0200 received badge  Popular Question (source)
2019-11-18 14:44:51 +0200 received badge  Student (source)
2019-11-18 13:45:46 +0200 asked a question Possible memory leak in polynomial evaluation

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?

2019-11-16 00:12:54 +0200 asked a question Memory increasing when using constant pi

Hello everybody,

I have some memory problems when executing the following for cycle in SageMath (version 8.9 on Linux Mint 19.2):

sage: precision = 165
sage: FFF = RealField(prec = precision)
sage: MAX = 32
sage: gpi = FFF.pi()
sage: trange = [2..555]
....: for t in trange:
....:     d = t*[exp (2*gpi*I*i/MAX) for i in range(MAX)]
....:     print "memory usage: " + str(get_memory_usage())

which outputs

memory usage: 2283.20703125 
memory usage: 2283.20703125 
memory usage: 2283.20703125
...
memory usage: 2292.2421875
memory usage: 2292.4921875
memory usage: 2292.4921875
memory usage: 2292.4921875

I found that the situation improves if I remove the gpi variable from the for cycle, obtaining

memory usage: 2274.86328125
memory usage: 2274.86328125
memory usage: 2274.86328125
...
memory usage: 2275.12109375
memory usage: 2275.12109375

Is there some way to avoid this increment in memory?

Thank you in advance