On Wednesday, March 23, 2016 at 9:17:58 AM UTC-7, vdelecroix wrote:
>
> Hello, 
>
> Some friend just sent an e-mail to me mentioning a memory leak. Here is 
> a minimal example 
>
> sage: x = polygen(ZZ) 
> sage: K = NumberField(x**3 - 2, 'cbrt2', embedding=RR(1.2599)) 
> sage: w = K.gen() 
> sage: import resource 
> sage: resource.getrusage(resource.RUSAGE_SELF).ru_maxrss 
> 180720 
> sage: for _ in range(10000): test = w > 1 
> sage: resource.getrusage(resource.RUSAGE_SELF).ru_maxrss 
>

I tried python-level analysis:

import gc
from collections import Counter
gc.collect()
pre={id(c) for c in gc.get_objects()}

x = polygen(ZZ)
K = NumberField(x**3 - 2, 'cbrt2', embedding=RR(1.2599))
w = K.gen()
gc.collect()
pre={id(c) for c in gc.get_objects()}
for _ in range(20000): test = w > 1
gc.collect()
gc.collect()
post=Counter(type(o) for o in gc.get_objects() if id(o) not in pre)
sorted(post.iteritems(),key=lambda t: t[1])

C=[c for c in gc.get_objects() if id(c) not in pre and type(c) is tuple and 
type(c[0]) is sage.rings.real_mpfi.RealIntervalFieldElement]

 This finds a whole bunch of one-element tuples with a realintervalfield 
element. If I use objgraph_showbackrefs(C[100]) or something similar, I 
only  get the references via C! So it seems somehow these objects survived 
"gc.collect" without actually having objects referring to them. That would 
point towards an incref/decref error somewhere.

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

Reply via email to