#18897: Memory leak in polynomial_compiled.univar_pd
-------------------------+-------------------------------------------------
       Reporter:         |        Owner:
  slabbe                 |       Status:  needs_info
           Type:         |    Milestone:  sage-6.8
  defect                 |   Resolution:
       Priority:         |    Merged in:
  critical               |    Reviewers:
      Component:         |  Work issues:
  memleak                |       Commit:
       Keywords:         |  80ce8765811c7ac18b921467e113630169b6aaaf
        Authors:  Simon  |     Stopgaps:
  King                   |
Report Upstream:  N/A    |
         Branch:         |
  public/18897           |
   Dependencies:         |
-------------------------+-------------------------------------------------
Changes (by dimpase):

 * priority:  major => critical
 * status:  needs_review => needs_info


Comment:

 I just tried the example in the ticket description, both on unpatched and
 patched, and got
 the following disturbing output:
 {{{
 $ sage
 ┌────────────────────────────────────────────────────────────────────┐
 │ SageMath Version 6.8.beta8, Release Date: 2015-07-10               │
 │ Type "notebook()" for the browser-based notebook interface.        │
 │ Type "help()" for help.                                            │
 └────────────────────────────────────────────────────────────────────┘
 ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
 ┃ Warning: this is a prerelease version, and it may be unstable.     ┃
 ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
 sage: def test(L, dim):
         import gc
         from collections import Counter
         gc.collect()
         pre={id(c) for c in gc.get_objects()}
         for _ in range(100):
                 matrix(dim, L).eigenvalues()
         gc.collect()
         post=Counter(type(o) for o in gc.get_objects() if id(o) not in
 pre)
         return [(k,v) for (k,v) in post.iteritems() if v>10]
 ....:
 sage: L = [1,0,0,1,0,0,1,1,0,0,0,1,2,0,0,1,0,0,2,0,0,0,0,0,1]
 sage: test(L, 5)
 [(<class 'sage.structure.dynamic_class.DynamicMetaclass'>, 11),
  (<type 'instance'>, 106),
  (<type 'function'>, 1680),
  (<type 'dict'>, 271),
  (<type 'type'>, 78),
  (<type 'method_descriptor'>, 195),
  (<type 'wrapper_descriptor'>, 403),
  (<type 'property'>, 37),
  (<type 'classobj'>, 13),
  (<type 'module'>, 83),
  (<type 'list'>, 262),
  (<type 'sage.misc.constant_function.ConstantFunction'>, 21),
  (<type 'tuple'>, 264),
  (<type 'getset_descriptor'>, 199),
  (<class 'weakref.KeyedRef'>, 64),
  (<class 'numpy.testing.nosetester.NoseTester'>, 19),
  (<type 'staticmethod'>, 50),
  (<type 'member_descriptor'>, 12),
  (<type 'builtin_function_or_method'>, 177),
  (<type 'weakref'>, 152),
  (<type 'instancemethod'>, 22),
  (<type 'cell'>, 40)]
 sage:
 }}}

 if I re-run stuff, it works as it should; on the patched system:
 {{{
 sage: test(L, 5) # as before the fix:
 []
 sage: L = [1,1,0,1,0,1,2,1,1,0,0,1,2,0,0,1,1,0,2,0,0,0,0,0,1]
 sage: test(L, 5) # did not work before the fix:
 []
 sage:
 }}}

 on the unpatched system:
 {{{
 sage: test(L, 5)
 []
 sage: L = [1,1,0,1,0,1,2,1,1,0,0,1,2,0,0,1,1,0,2,0,0,0,0,0,1]
 sage: test(L, 5)
 [(<type 'sage.rings.polynomial.polynomial_compiled.univar_pd'>, 500)]
 sage:
 }}}

 In short: something happens on the 1st call...
 Perhaps it is harmless, I don't know.

--
Ticket URL: <http://trac.sagemath.org/ticket/18897#comment:27>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

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

Reply via email to