#13447: Make libsingular multivariate polynomial rings collectable
----------------------------------------------------------------+-----------
Reporter: nbruin |
Owner: rlm
Type: defect |
Status: needs_work
Priority: major |
Milestone: sage-5.4
Component: memleak |
Resolution:
Keywords: | Work
issues: Input from a libsingular expert
Report Upstream: None of the above - read trac for reasoning. |
Reviewers:
Authors: Nils Bruin, Simon King | Merged
in:
Dependencies: #11521 |
Stopgaps:
----------------------------------------------------------------+-----------
Comment (by SimonKing):
Having a function that shows the refcount really is a good idea! I already
found that elements of a non-commutative ring do not increment the
refcount to the underlying "libplural" ring.
Anyway, a new test in the commutative setting shall be:
{{{
sage: import gc
sage: gc.collect() # random
sage: R.<x,y,z> = GF(5)[]
sage: R._get_refcount()
7
sage: p = x*y+z
sage: R._get_refcount()
8
sage: del p
sage: gc.collect() # random
sage: R._get_refcount()
7
}}}
Of course, the question is whether we really need to incref the ring if we
create an element. I think, in the commutative case, it ''is'' needed,
because deallocation of an element refers to the cparent.
It could be that in the non-commutative case we have already a work-
around:
{{{
def __dealloc__(self):
# TODO: Warn otherwise!
# for some mysterious reason, various things may be NULL in some
cases
if self._parent is not <ParentWithBase>None and
(<NCPolynomialRing_plural>self._parent)._ring != NULL and self._poly !=
NULL:
p_Delete(&self._poly,
(<NCPolynomialRing_plural>self._parent)._ring)
}}}
I think we could leave it like that, for now. If someone feels it is
needed, then he/she may change `NCPolynomial_plural` to use templates.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13447#comment:37>
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.