#12215: Memleak in UniqueRepresentation, @cached_method
--------------------------------------------------------------+-------------
       Reporter:  vbraun                                      |         Owner:  
          
           Type:  defect                                      |        Status:  
needs_work
       Priority:  major                                       |     Milestone:  
sage-5.7  
      Component:  memleak                                     |    Resolution:  
          
       Keywords:  UniqueRepresentation cached_method caching  |   Work issues:  
          
Report Upstream:  N/A                                         |     Reviewers:  
Nils Bruin
        Authors:  Simon King                                  |     Merged in:  
          
   Dependencies:                                              |      Stopgaps:  
          
--------------------------------------------------------------+-------------

Comment (by SimonKing):

 What I get is:
 {{{
 Program received signal SIGSEGV, Segmentation fault.
 0x00007fffedeb9f4c in
 __pyx_pf_4sage_9structure_11coerce_dict_16TripleDictEraser_2__call__
 (__pyx_v_self=0x73982d0, __pyx_v_r=0x7fffea2aaf00) at
 sage/structure/coerce_dict.c:1107
 1107      __pyx_t_10 = PyList_GET_ITEM(__pyx_t_1, (__pyx_v_h %
 PyList_GET_SIZE(__pyx_t_4)));
 (gdb) bt
 #0  0x00007fffedeb9f4c in
 __pyx_pf_4sage_9structure_11coerce_dict_16TripleDictEraser_2__call__
 (__pyx_v_self=0x73982d0, __pyx_v_r=0x7fffea2aaf00) at
 sage/structure/coerce_dict.c:1107
 #1  0x00007fffedeb9592 in
 __pyx_pw_4sage_9structure_11coerce_dict_16TripleDictEraser_3__call__
 (__pyx_v_self=0x73982d0, __pyx_args=0x75bfd10, __pyx_kwds=0x0) at
 sage/structure/coerce_dict.c:966
 #2  0x00007ffff79be33e in PyObject_Call (func=0x73982d0, arg=0x75bfd10,
 kw=0x0) at Objects/abstract.c:2529
 #3  0x00007ffff79bf059 in PyObject_CallFunctionObjArgs
 (callable=0x73982d0) at Objects/abstract.c:2760
 #4  0x00007ffff7a64194 in handle_callback (ref=0x7fffea2aaf00,
 callback=0x73982d0) at Objects/weakrefobject.c:881
 #5  0x00007ffff7a645e9 in PyObject_ClearWeakRefs (object=0x90c07b0) at
 Objects/weakrefobject.c:965
 #6  0x00007fffee53af5b in
 __pyx_tp_dealloc_4sage_9structure_15category_object_CategoryObject
 (o=0x90c07b0) at sage/structure/category_object.c:8990
 #7  0x00007fffee7e6fe0 in __pyx_tp_dealloc_4sage_9structure_6parent_Parent
 (o=0x90c07b0) at sage/structure/parent.c:21519
 #8  0x00007fffeea2aa7f in
 __pyx_tp_dealloc_4sage_9structure_10parent_old_Parent (o=0x90c07b0) at
 sage/structure/parent_old.c:7261
 #9  0x00007fffeec3bca8 in
 __pyx_tp_dealloc_4sage_9structure_11parent_base_ParentWithBase
 (o=0x90c07b0) at sage/structure/parent_base.c:1876
 #10 0x00007fffead58cbc in
 __pyx_tp_dealloc_4sage_9structure_11parent_gens_ParentWithGens
 (o=0x90c07b0) at sage/structure/parent_gens.c:5865
 #11 0x00007ffff7a4ce4c in subtype_dealloc (self=0x90c07b0) at
 Objects/typeobject.c:1014
 #12 0x00007ffff7a27be4 in _Py_Dealloc (op=0x90c07b0) at
 Objects/object.c:2243
 #13 0x00007ffff7a480b0 in tupledealloc (op=0x845ab50) at
 Objects/tupleobject.c:220
 #14 0x00007ffff7a27be4 in _Py_Dealloc (op=0x845ab50) at
 Objects/object.c:2243
 #15 0x00007ffff7a480b0 in tupledealloc (op=0x7fffea2a0760) at
 Objects/tupleobject.c:220
 #16 0x00007ffff7a27be4 in _Py_Dealloc (op=0x7fffea2a0760) at
 Objects/object.c:2243
 #17 0x00007ffff7a18e8e in dict_dealloc (mp=0x9052b70) at
 Objects/dictobject.c:985
 #18 0x00007ffff7a27be4 in _Py_Dealloc (op=0x9052b70) at
 Objects/object.c:2243
 #19 0x00007ffff7a4cd73 in subtype_dealloc (self=0x85045a0) at
 Objects/typeobject.c:999
 #20 0x00007ffff7a27be4 in _Py_Dealloc (op=0x85045a0) at
 Objects/object.c:2243
 #21 0x00007fffed102313 in
 __pyx_tp_dealloc_4sage_10categories_7functor_Functor (o=0x7985950) at
 sage/categories/functor.c:3209
 #22 0x00007fffecee64a1 in
 __pyx_tp_dealloc_4sage_10categories_6action_Action (o=0x7985950) at
 sage/categories/action.c:6461
 #23 0x00007fffbcd614ea in
 __pyx_tp_dealloc_4sage_6matrix_6action_MatrixMulAction (o=0x7985950) at
 sage/matrix/action.c:4724
 #24 0x00007ffff7a27be4 in _Py_Dealloc (op=0x7985950) at
 Objects/object.c:2243
 #25 0x00007ffff7a02c8e in list_dealloc (op=0x759fa38) at
 Objects/listobject.c:309
 #26 0x00007ffff7a27be4 in _Py_Dealloc (op=0x759fa38) at
 Objects/object.c:2243
 #27 0x00007ffff7a02c8e in list_dealloc (op=0x7964858) at
 Objects/listobject.c:309
 #28 0x00007ffff7a27be4 in _Py_Dealloc (op=0x7964858) at
 Objects/object.c:2243
 #29 0x00007fffedecec13 in
 __pyx_tp_clear_4sage_9structure_11coerce_dict_TripleDict (o=0x3cbd8d0) at
 sage/structure/coerce_dict.c:5921
 #30 0x00007ffff7b1378b in delete_garbage (collectable=0x7fffffff30f0,
 old=0x7ffff7dc1540 <generations+96>) at Modules/gcmodule.c:769
 #31 0x00007ffff7b13d04 in collect (generation=2) at Modules/gcmodule.c:930
 #32 0x00007ffff7b13f06 in collect_generations () at Modules/gcmodule.c:996
 #33 0x00007ffff7b14bcc in _PyObject_GC_Malloc (basicsize=264) at
 Modules/gcmodule.c:1457
 #34 0x00007ffff7b14c04 in _PyObject_GC_New (tp=0x7ffff7d9c5a0
 <PyDict_Type>) at Modules/gcmodule.c:1467
 #35 0x00007ffff7a16cc7 in PyDict_New () at Objects/dictobject.c:277
 #36 0x00007fffeaa83860 in
 __pyx_f_4sage_4libs_4pari_3gen_12PariInstance_new_ref
 (__pyx_v_self=0xcceae0, __pyx_v_g=0xa968360, __pyx_v_parent=0xa8d8748) at
 sage/libs/pari/gen.c:49228
 #37 0x00007fffea9fb417 in
 __pyx_pf_4sage_4libs_4pari_3gen_3gen_80__getitem__
 (__pyx_v_self=0xa8d8748, __pyx_v_n=0x61f7f0) at sage/libs/pari/gen.c:8638
 #38 0x00007fffea9f63b7 in
 __pyx_pw_4sage_4libs_4pari_3gen_3gen_81__getitem__
 (__pyx_v_self=0xa8d8748, __pyx_v_n=0x61f7f0) at sage/libs/pari/gen.c:7643
 #39 0x00007fffeaa9a688 in __pyx_sq_item_4sage_4libs_4pari_3gen_gen
 (o=0xa8d8748, i=1) at sage/libs/pari/gen.c:55757
 #40 0x00007ffff79bcdd7 in PySequence_GetItem (s=0xa8d8748, i=1) at
 Objects/abstract.c:1989
 #41 0x00007ffff7a01934 in iter_iternext (iterator=0xa99c300) at
 Objects/iterobject.c:58
 #42 0x00007ffff7a04abe in listextend (self=0xa7db060, b=0xa8d8748) at
 Objects/listobject.c:872
 #43 0x00007ffff7a08ad9 in list_init (self=0xa7db060, args=0xa7a3920,
 kw=0x0) at Objects/listobject.c:2458
 #44 0x00007ffff7a4c1ad in type_call (type=0x7ffff7d9a3c0 <PyList_Type>,
 args=0xa7a3920, kwds=0x0) at Objects/typeobject.c:737
 #45 0x00007ffff79be33e in PyObject_Call (func=0x7ffff7d9a3c0
 <PyList_Type>, arg=0xa7a3920, kw=0x0) at Objects/abstract.c:2529
 #46 0x00007fffea9eb6f1 in __pyx_pf_4sage_4libs_4pari_3gen_3gen_12list
 (__pyx_v_self=0xa8d87d0) at sage/libs/pari/gen.c:4507
 #47 0x00007fffea9eb4a0 in __pyx_pw_4sage_4libs_4pari_3gen_3gen_13list
 (__pyx_v_self=0xa8d87d0, unused=0x0) at sage/libs/pari/gen.c:4455
 #48 0x00007ffff7a21156 in PyCFunction_Call (func=0xa85b858,
 arg=0x7ffff7f90060, kw=0x0) at Objects/methodobject.c:90
 #49 0x00007ffff79be33e in PyObject_Call (func=0xa85b858,
 arg=0x7ffff7f90060, kw=0x0) at Objects/abstract.c:2529
 #50 0x00007fffe14ff0aa in
 
__pyx_pf_4sage_5rings_10polynomial_25polynomial_rational_flint_25Polynomial_rational_flint_6__init__
 (__pyx_v_self=0xa781258, __pyx_v_parent=0x135f730, __pyx_v_x=0xa8d87d0,
     __pyx_v_check=0x7ffff7d89ec0 <_Py_TrueStruct>,
 __pyx_v_is_gen=0x7ffff7d89e80 <_Py_ZeroStruct>,
 __pyx_v_construct=0x7ffff7d89e80 <_Py_ZeroStruct>)
     at sage/rings/polynomial/polynomial_rational_flint.cpp:5760
 #51 0x00007fffe14fc966 in
 
__pyx_pw_4sage_5rings_10polynomial_25polynomial_rational_flint_25Polynomial_rational_flint_7__init__
 (__pyx_v_self=0xa781258, __pyx_args=0xa6f97d0, __pyx_kwds=0xa83c050)
     at sage/rings/polynomial/polynomial_rational_flint.cpp:5165
 #52 0x00007ffff7a4c1ad in type_call (type=0x7fffe174bc20
 
<__pyx_type_4sage_5rings_10polynomial_25polynomial_rational_flint_Polynomial_rational_flint>,
 args=0xa6f97d0, kwds=0xa83c050)
     at Objects/typeobject.c:737
 #53 0x00007ffff79be33e in PyObject_Call (func=0x7fffe174bc20
 
<__pyx_type_4sage_5rings_10polynomial_25polynomial_rational_flint_Polynomial_rational_flint>,
 arg=0xa6f97d0, kw=0xa83c050)
     at Objects/abstract.c:2529
 #54 0x00007ffff7ac8282 in ext_do_call (func=0x7fffe174bc20
 
<__pyx_type_4sage_5rings_10polynomial_25polynomial_rational_flint_Polynomial_rational_flint>,
 pp_stack=0x7fffffff3a98, flags=2, na=4, nk=1)
     at Python/ceval.c:4334
 #55 0x00007ffff7ac1a8b in PyEval_EvalFrameEx (f=0xa663520, throwflag=0) at
 Python/ceval.c:2705
 #56 0x00007ffff7ac420b in PyEval_EvalCodeEx (co=0x7fffe303bb40,
 globals=0x10a78b0, locals=0x0, args=0xa8acf10, argcount=2, kws=0x0,
 kwcount=0, defs=0x7fffe17556e8, defcount=4, closure=0x0)
     at Python/ceval.c:3253
 #57 0x00007ffff79fd447 in function_call (func=0x7fffdfc76ae0,
 arg=0xa8acee8, kw=0x0) at Objects/funcobject.c:526
 #58 0x00007ffff79be33e in PyObject_Call (func=0x7fffdfc76ae0,
 arg=0xa8acee8, kw=0x0) at Objects/abstract.c:2529
 #59 0x00007ffff79da359 in instancemethod_call (func=0x7fffdfc76ae0,
 arg=0xa8acee8, kw=0x0) at Objects/classobject.c:2578
 #60 0x00007ffff79be33e in PyObject_Call (func=0x7ffff0cdf060,
 arg=0x7fffea521990, kw=0x0) at Objects/abstract.c:2529
 #61 0x00007fffe6888d3b in
 __pyx_f_4sage_9structure_11coerce_maps_24DefaultConvertMap_unique__call_
 (__pyx_v_self=0x7fffbcf7f3f0, __pyx_v_x=0xa8d87d0, __pyx_skip_dispatch=0)
     at sage/structure/coerce_maps.c:3485
 #62 0x00007fffee7acda1 in
 __pyx_pf_4sage_9structure_6parent_6Parent_28__call__
 (__pyx_v_self=0x135f730, __pyx_v_x=0xa8d87d0, __pyx_v_args=0x7ffff7f90060,
 __pyx_v_kwds=0xa751480)
     at sage/structure/parent.c:7415
 #63 0x00007fffee7ac0a4 in
 __pyx_pw_4sage_9structure_6parent_6Parent_29__call__
 (__pyx_v_self=0x135f730, __pyx_args=0xa80fc30, __pyx_kwds=0x0) at
 sage/structure/parent.c:7096
 #64 0x00007ffff79be33e in PyObject_Call (func=0x135f730, arg=0xa80fc30,
 kw=0x0) at Objects/abstract.c:2529
 #65 0x00007fffddd720a3 in
 
__pyx_pf_4sage_5rings_12number_field_20number_field_element_18NumberFieldElement_2__init__
 (__pyx_v_self=0xa860400, __pyx_v_parent=0x331b730, __pyx_v_f=0xa8d87d0)
     at sage/rings/number_field/number_field_element.cpp:6090
 #66 0x00007fffddd6d545 in
 
__pyx_pw_4sage_5rings_12number_field_20number_field_element_18NumberFieldElement_3__init__
 (__pyx_v_self=0xa860400, __pyx_args=0xa85eab0, __pyx_kwds=0x0)
     at sage/rings/number_field/number_field_element.cpp:5340
 #67 0x00007ffff7a595f6 in wrap_init (self=0xa860400, args=0xa85eab0,
     wrapped=0x7fffddd6d316
 
<__pyx_pw_4sage_5rings_12number_field_20number_field_element_18NumberFieldElement_3__init__(PyObject*,
 PyObject*, PyObject*)>, kwds=0x0) at Objects/typeobject.c:4719
 #68 0x00007ffff79e2145 in wrapper_call (wp=0xa99c220, args=0xa85eab0,
 kwds=0x0) at Objects/descrobject.c:998
 #69 0x00007ffff79be33e in PyObject_Call (func=0xa99c220, arg=0xa85eab0,
 kw=0x0) at Objects/abstract.c:2529
 #70 0x00007ffff7ac6404 in PyEval_CallObjectWithKeywords (func=0xa99c220,
 arg=0xa85eab0, kw=0x0) at Python/ceval.c:3890
 #71 0x00007ffff79e1194 in wrapperdescr_call (descr=0x7fffde6d9ae0,
 args=0xa85eab0, kwds=0x0) at Objects/descrobject.c:306
 #72 0x00007ffff79be33e in PyObject_Call (func=0x7fffde6d9ae0,
 arg=0xa881360, kw=0x0) at Objects/abstract.c:2529
 #73 0x00007fffddaddacf in
 
__pyx_pf_4sage_5rings_12number_field_30number_field_element_quadratic_28NumberFieldElement_quadratic___init__
 (__pyx_v_self=0xa860400, __pyx_v_parent=0x331b730,
     __pyx_v_f=0xa8d87d0) at
 sage/rings/number_field/number_field_element_quadratic.cpp:3893
 #74 0x00007fffddadbbdb in
 
__pyx_pw_4sage_5rings_12number_field_30number_field_element_quadratic_28NumberFieldElement_quadratic_1__init__
 (__pyx_v_self=0xa860400, __pyx_args=0xa85ca38, __pyx_kwds=0x0)
     at sage/rings/number_field/number_field_element_quadratic.cpp:3386
 #75 0x00007ffff7a4c1ad in type_call (type=0x7fffddd15020
 
<__pyx_type_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic>,
 args=0xa85ca38, kwds=0x0)
     at Objects/typeobject.c:737
 #76 0x00007ffff79be33e in PyObject_Call (func=0x7fffddd15020
 
<__pyx_type_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic>,
 arg=0xa85ca38, kw=0x0)
     at Objects/abstract.c:2529
 #77 0x00007ffff7ac7bc3 in do_call (func=0x7fffddd15020
 
<__pyx_type_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic>,
 pp_stack=0x7fffffff4a10, na=2, nk=0)
     at Python/ceval.c:4239
 #78 0x00007ffff7ac6efc in call_function (pp_stack=0x7fffffff4a10, oparg=2)
 at Python/ceval.c:4044
 #79 0x00007ffff7ac17f9 in PyEval_EvalFrameEx (f=0x33b1e00, throwflag=0) at
 Python/ceval.c:2666
 #80 0x00007ffff7ac71f4 in fast_function (func=0x7fffddd47450,
 pp_stack=0x7fffffff4d90, n=2, na=2, nk=0) at Python/ceval.c:4107
 #81 0x00007ffff7ac6ee0 in call_function (pp_stack=0x7fffffff4d90, oparg=1)
 at Python/ceval.c:4042
 #82 0x00007ffff7ac17f9 in PyEval_EvalFrameEx (f=0x37a3270, throwflag=0) at
 Python/ceval.c:2666
 #83 0x00007ffff7ac420b in PyEval_EvalCodeEx (co=0x7fffde989ca0,
 globals=0x1108b20, locals=0x0, args=0xa850f10, argcount=2, kws=0x0,
 kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:3253
 #84 0x00007ffff79fd447 in function_call (func=0x7fffddd43108,
 arg=0xa850ee8, kw=0x0) at Objects/funcobject.c:526
 #85 0x00007ffff79be33e in PyObject_Call (func=0x7fffddd43108,
 arg=0xa850ee8, kw=0x0) at Objects/abstract.c:2529
 #86 0x00007ffff79da359 in instancemethod_call (func=0x7fffddd43108,
 arg=0xa850ee8, kw=0x0) at Objects/classobject.c:2578
 #87 0x00007ffff79be33e in PyObject_Call (func=0x7fffc2ecc360,
 arg=0xa70d1b0, kw=0x0) at Objects/abstract.c:2529
 #88 0x00007fffe6888d3b in
 __pyx_f_4sage_9structure_11coerce_maps_24DefaultConvertMap_unique__call_
 (__pyx_v_self=0x7fffbcd4b780, __pyx_v_x=0xa8d87d0, __pyx_skip_dispatch=0)
     at sage/structure/coerce_maps.c:3485
 #89 0x00007fffee7acda1 in
 __pyx_pf_4sage_9structure_6parent_6Parent_28__call__
 (__pyx_v_self=0x331b730, __pyx_v_x=0xa8d87d0, __pyx_v_args=0x7ffff7f90060,
 __pyx_v_kwds=0xa9d32c0)
     at sage/structure/parent.c:7415
 #90 0x00007fffee7ac0a4 in
 __pyx_pw_4sage_9structure_6parent_6Parent_29__call__
 (__pyx_v_self=0x331b730, __pyx_args=0xa7a3a70, __pyx_kwds=0x0) at
 sage/structure/parent.c:7096
 #91 0x00007ffff79be33e in PyObject_Call (func=0x331b730, arg=0xa7a3a70,
 kw=0x0) at Objects/abstract.c:2529
 #92 0x00007ffff7ac6404 in PyEval_CallObjectWithKeywords (func=0x331b730,
 arg=0xa7a3a70, kw=0x0) at Python/ceval.c:3890
 #93 0x00007ffff7ab2344 in builtin_map (self=0x0, args=0xa8dde70) at
 Python/bltinmodule.c:1038
 #94 0x00007ffff7a210f2 in PyCFunction_Call (func=0x7ffff7f52060,
 arg=0xa8dde70, kw=0x0) at Objects/methodobject.c:81
 #95 0x00007ffff7ac6cdc in call_function (pp_stack=0x7fffffff5900, oparg=2)
 at Python/ceval.c:4021
 #96 0x00007ffff7ac17f9 in PyEval_EvalFrameEx (f=0x3944d10, throwflag=0) at
 Python/ceval.c:2666
 ...
 }}}
 I see a couple of familiar names in the backtrace...

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12215#comment:150>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to