On Monday, July 13, 2015 at 10:39:17 AM UTC+2, Ralf Stephan wrote: > > As quick hint I would use valgrind for the search. > http://wiki.sagemath.org/ValgrindingSage >
Does valgrind understand python memory layout? most leaks in sage are due to lingering references and hence are detectable by python. If I run: import gc from collections import Counter gc.collect() pre={id(c) for c in gc.get_objects()} n = 5 m = Integer(n*(n-1)/2) for i in IntegerRange(2^m): d = i.digits(base=2, padto=m) l = [[1]+[0]*(n-1)] for j in range(n-1): l.append( d[(j+1)*j/2:(j+1)*(j+2)/2]+ [1] + [0]*(n-j-2) ) M = Matrix(l) eig = sorted((M*M.transpose()).eigenvalues())[0] if eig <= 0: print "Foobar" 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]) I find: ... [(<type 'set'>, 1), (<type 'generator'>, 1), (<type 'builtin_function_or_method'>, 1), (<class '_ast.Attribute'>, 1), (<class 'sage.rings.qqbar.AlgebraicPolynomialTracker'>, 1), (<class 'sage.rings.qqbar.ANRoot'>, 1), (<type 'enumerate'>, 1), (<class '_ast.Interactive'>, 1), (<class '_ast.comprehension'>, 1), (<type 'function'>, 1), (<type 'instancemethod'>, 1), (<class 'sage.rings.polynomial.polynomial_element_generic.Polynomial_generic_dense_field'>, 1), (<type 'listiterator'>, 1), (<class '_ast.Assign'>, 1), (<type 'sage.rings.complex_interval.ComplexIntervalFieldElement'>, 1), (<class '_ast.Compare'>, 1), (<class '_ast.GeneratorExp'>, 1), (<class '_ast.Module'>, 1), (<type 'weakref'>, 3), (<class '_ast.Call'>, 4), (<type 'frame'>, 6), (<type 'sage.rings.rational.Rational'>, 6), (<type 'sage.rings.real_mpfi.RealIntervalFieldElement'>, 6), (<class 'sage.rings.qqbar.ANRational'>, 6), (<class 'sage.rings.qqbar.AlgebraicNumber'>, 7), (<class '_ast.Name'>, 9), (<type 'tuple'>, 11), (<type 'list'>, 29), (<type 'dict'>, 32), (<type 'sage.rings.polynomial.polynomial_compiled.univar_pd'>, 6273)] ... so I'd think there's a leak in constructing univar_pd. My guess would be a cached routine that shouldn't be cached. -- 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 http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.