Am 2014-08-11 um 16:19 schrieb Nils Bruin:
> On Monday, August 11, 2014 4:46:45 AM UTC-7, Daniel Krenn wrote:
> As expected.  If you want to get some idea of what is taking memory at
> the sage side you could do something like
> 
> import gc
> from collections import Counter
> gc.collect()
> pre={id(c) for c in gc.get_objects()}
> 
> <your computation>
> 
> 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])

(<class 'sage.symbolic.function_factory.NewSymbolicFunction'>, 1)
(<type 'builtin_function_or_method'>, 1)
(<type 'set'>, 1)
(<type 'module'>, 1)
(<type 'sage.structure.coerce_actions.LeftModuleAction'>, 1)
(<type 'sage.misc.function_mangling.ArgumentFixer'>, 1)
(<type 'sage.rings.real_double.ToRDF'>, 1)
(<class 'sage.symbolic.function_factory.NewSymbolicFunction'>, 1)
(<type 'sage.rings.real_mpfr.double_toRR'>, 2)
(<type 'sage.structure.coerce_maps.NamedConvertMap'>, 2)
(<type 'sage.categories.morphism.CallMorphism'>, 3)
(<type 'type'>, 3)
(<type 'frame'>, 4)
(<type 'sage.structure.coerce_maps.DefaultConvertMap_unique'>, 4)
(<type 'getset_descriptor'>, 4)
(<type 'staticmethod'>, 7)
(<class 'sage.structure.dynamic_class.DynamicMetaclass'>, 7)
(<type 'sage.misc.constant_function.ConstantFunction'>, 12)
(<type 'list'>, 12)
(<type 'function'>, 16)
(<type 'dict'>, 16)
(<type 'cell'>, 24)
(<class 'weakref.KeyedRef'>, 147)
(<type 'weakref'>, 151)
(<type 'sage.rings.complex_interval.ComplexIntervalFieldElement'>, 2175)
(<type 'sage.rings.real_mpfi.RealIntervalFieldElement'>, 8563)
(<type 'sage.symbolic.expression.Expression'>, 28257)
(<type 'tuple'>, 38713)
(<type 'sage.rings.rational.Rational'>, 3555901)

> It'll give you a list of python object types that occur in memory,
> sorted by count. This might give you an indication of what is leaking on
> the python side. It may well be nothing, in which case it's probably
> maxima leaking or ecl keeping freed memory mapped for future use. It's
> likely that the memory behaviour you're observing isn't easily changed.

It doesn't look like the results above help (but maybe I just interpret
them wrongly)

Daniel

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

Reply via email to