#11339: Illegal use of __deallocate__ in cython (pyx) code
-----------------------------------------------+----------------------------
Reporter: gagern | Owner: drkirkby
Type: defect | Status: needs_review
Priority: major | Milestone: sage-4.7.1
Component: porting | Keywords: sd31
Work_issues: | Upstream: N/A
Reviewer: François Bissey, Steven Trogdon | Author: Volker Braun,
Martin von Gagern
Merged: | Dependencies:
-----------------------------------------------+----------------------------
Comment(by gagern):
Replying to [comment:16 vbraun]:
I had considered keeping only that C pointer, but decided against it.
> Because parents are immutable we don't have to worry about the `ring *`
> pointer becoming invalid.
Can you explain this in more detail? Why does the parent object being
immutable help in keeping the pointer valid? Do you mean that the parent
cython object doesn't change it's ring member? That is correct, but not
enough to make the approach safe: if you don't keep a reference to the
parent python object around, python might decide to garbage-collect that
first, leading to a call to the singula function rDelete. I guess that
function at least frees the memory, so if you are unlucky, some thread
will overwrite the memory that ring points to with completely different
data. Of course, in most cases you'd be lucky, so you wouldn't notice the
problem. But unless singular does some reference counting of its own in
such a way that a rDelete call on the parent won't have immediate effect,
your approach isn't safe.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11339#comment:17>
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.