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.