Continuing ... I think the patches made some difference. Previously, I
saw a bunch of MatrixSpaces on the heap and they seem to have
disappeared. However, there are a whole bunch of IntegerModRings still
around. A very conspicuous structure is an ordinary dictionary that
has IntegerModRings as keys and True as values. It seems to have all
IntegerModRings ever produced in the run. I don't know where it's
coming from. According to gc, no-one refers to it, yet it doesn't get
collected. Also it seems like a data structure that gets updated, so
someone must be keeping a reference. Something c-level perhaps?

Code to find the object:

import gc, collections
alg='default'
n,m=10,22
B=20
M=sage.misc.getusage.linux_memory_usage()
set_random_seed(0)
for j in range(3000):
    _=matrix(QQ,n,m,[randint(-B,B)/randint(1,B) for i in
range(n*m)]).echelon_form(alg)
    if (j%250) ==0 :
        gc.collect()
        Mn=sage.misc.getusage.linux_memory_usage()
        print Mn-M
        M=Mn

gc.collect()

L=[x for x in gc.get_objects() if type(x) is dict and
    len(x) > 2500 and
    isinstance(x.keys()
[0],sage.rings.finite_rings.integer_mod_ring.IntegerModRing_generic)]

assert len(L) == 1
V=[x for x in gc.get_referrers(L[0])]
assert len(V) == 1 and V[0] is L

#The mysterious object is now L[0] and the next line shows that it
doesn't really have a reference (the only one being the list L which
we have just created)

-- 
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org



Reply via email to