#14059: Fix refcount/deallocation of integers
-----------------------------+----------------------------------------------
Reporter: SimonKing | Owner: rlm
Type: defect | Status: new
Priority: blocker | Milestone: sage-5.7
Component: memleak | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: | Stopgaps:
-----------------------------+----------------------------------------------
Comment (by SimonKing):
Replying to [comment:22 jpflori]:
> > The created integers are:
> >
> > * 0
> > * 1
> > * ONE (hence, the integer 1 is created, and then another 1 is created
and assigned to ONE)
> > * -1
> > * 0
> > * 1
> > * `global_dummy_Integer` (which is 0)
> >
> > And them the hooks are established.
> >
> > > Creating ONE after hooking up the method (seemingly) solves the
problem.
> >
> > But probably we should take care of the other elements as well.
> Yup.
It is obvious where the integers between ONE and `global_dummy_Integer`
come from:
{{{
ONE = Integer(1)
cdef long small_pool_min = -1
cdef long small_pool_max = 1
cdef list small_pool = [Integer(k) for k in range(small_pool_min,
small_pool_max+1)]
cdef inline Integer smallInteger(long value):
cdef Integer z
if small_pool_min <= value <= small_pool_max:
return <Integer>small_pool[value - small_pool_min]
else:
z = PY_NEW(Integer)
mpz_set_si(z.value, value)
return z
}}}
Before ONE, the function `zero_one_elements()` creates 0 and 1 before ONE.
So, our current guess is that we should move the creation of the dummy and
the hooking to the very beginning of the module, right?
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14059#comment:25>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.