#12313: Fix yet another memory leak caused by caching of coercion data
--------------------------------------------------+-------------------------
Reporter: SimonKing | Owner:
Type: defect | Status:
needs_review
Priority: major | Milestone: sage-5.3
Component: memleak | Resolution:
Keywords: coercion weak dictionary | Work issues:
Report Upstream: N/A | Reviewers: Simon King,
Jean-Pierre Flori, John Perry
Authors: Simon King, Jean-Pierre Flori | Merged in:
Dependencies: #11521, #11599, #12969, #12215 | Stopgaps:
--------------------------------------------------+-------------------------
Comment (by SimonKing):
Replying to [comment:213 nbruin]:
> I've instrumented the remove function on the `WeakValueDictionary` a
little bit:
I did a similar thing, printing a message naming the ref.key before
deletion and after deletion. Then I ran sage -t --verbose on my small test
file.
Problem: All deletions were successful!
To be precise, it all starts with many deletions, happening at Sage
startup. Apparently Sage computes a lot of things that are then
immediately garbage collected. And then, the tests themselves look like
this:
{{{
Trying:
set_random_seed(0L)
Expecting nothing
ok
Trying:
change_warning_output(sys.stdout)
Expecting nothing
ok
Trying:
B = BooleanPolynomialRing(names=('a', 'b', 'c', 'd', 'e', 'f',)); (a,
b, c, d, e, f,) = B._first_ngens(6)###line 2:_sage_ >>> B.<a,b,c,d,e,f>
= BooleanPolynomialRing()
Expecting nothing
ok
Trying:
I = ideal(a*b + a + b*e + c*e + Integer(1), a + b + c*d + c +
Integer(1), a*c + c + d*f + d + Integer(1), a*c + c*f + c + d*f +
Integer(1), c*f + c + d + e + Integer(1), a + b*c + b*d + e*f +
Integer(1))###line 3:_sage_ >>> I = ideal(a*b + a + b*e + c*e + 1, a +
b + c*d + c + 1, a*c + c + d*f + d + 1, a*c + c*f + c + d*f + 1, c*f + c +
d + e + 1, a + b*c + b*d + e*f + 1)
Expecting nothing
ok
Trying:
I.groebner_basis()###line 4:_sage_ >>> I.groebner_basis()
Expecting:
[1]
**********************************************************************
File "/home/king/SAGE/tests/pbori/pboriNeu/test_12.py", line ?, in
__main__.example_0
Failed example:
I.groebner_basis()###line 4:_sage_ >>> I.groebner_basis()
Expected:
[1]
Got:
try to remove (('RingHomset_generic_with_category', (<class
'sage.rings.homset.RingHomset_generic'>, <class
'sage.categories.category.JoinCategory.parent_class'>), None, None, <class
'sage.rings.homset.RingHomset_generic'>), ())
successful on (('RingHomset_generic_with_category', (<class
'sage.rings.homset.RingHomset_generic'>, <class
'sage.categories.category.JoinCategory.parent_class'>), None, None, <class
'sage.rings.homset.RingHomset_generic'>), ())
[1]
Trying:
sig_on_count()
Expecting:
0
ok
4 items had no tests:
__main__
__main__.change_warning_output
__main__.check_with_tolerance
__main__.warning_function
**********************************************************************
1 items had failures:
1 of 6 in __main__.example_0
6 tests in 5 items.
5 passed and 1 failed.
***Test Failed*** 1 failures.
*** glibc detected *** python: double free or corruption (out):
0x0000000004be7e60 ***
^CAborting further tests.
KeyboardInterrupt -- interrupted after 16.0 seconds!
----------------------------------------------------------------------
All tests passed!
}}}
So, there is only a Homset (for which there is a weak cache, by #11521)
being collected during the tests, and perhaps it hasn't been the weak
dictionary of polynomial rings, after all.
How can one find out what kind of thing got freed twice? I am afraid gdb
does not seem to work on doc tests, and I can not reproduce the problem
interactively.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12313#comment:216>
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.