#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:230 jpflori]:
> Anyway, it could be possible that the situation is as in FLINT: some
Sage method tries to directly deallocate something after we called the
Polybori cleanup method which already freed taht piece of memory and it
crashes.
That sounds like the solution should be as in the
[http://trac.sagemath.org/sage_trac/attachment/ticket/12215/trac12215_segfault_fixes.patch
segfault fix] for pari at #12215.
Generally, underlying C-data should be freed by using a method
`__dealloc__` (not `__del__`, please!). You need to be careful, because
during `__dealloc__` you can ''not'' assume that the Python attributes of
an instance are still working.
Hence, it is (in my opinion) very wrong that we had
{{{
import sage.matrix.matrix_mod2_dense
sage.matrix.matrix_mod2_dense.free_m4ri()
import sage.libs.flint.flint
sage.libs.flint.flint.free_flint_stack()
pari._unsafe_deallocate_pari_stack()
}}}
in sage.all.quit_sage (I only removed the pari._unsafe_deallocate... in
#12215).
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12313#comment:235>
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.