#14711: Memleak when creating QuadraticField
-------------------------------------------------+-------------------------
Reporter: jpflori | Owner:
Type: defect | davidloeffler
Priority: critical | Status: new
Component: number fields | Milestone: sage-5.13
Keywords: memleak, number field, | Resolution:
QuadraticField | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: u/SimonKing/ticket/14711 | Commit:
Dependencies: | Stopgaps:
-------------------------------------------------+-------------------------
Comment (by SimonKing):
Anyway, here is the problem I am currently having:
{{{
sage: E = ModularSymbols(11).2
sage: s = E.modular_symbol_rep()
sage: del E,s
sage: import gc
sage: gc.collect()
1309
sage: E = ModularSymbols(11).2
sage: v = E.manin_symbol_rep()
sage: c,x = v[0]
sage: y = x.modular_symbol_rep()
sage: y.parent()
Abelian Group of all Formal Finite Sums over Integer Ring
sage: A = y.parent().get_action(QQ, self_on_left=False, op=operator.mul)
sage: A.right_domain()
Abelian Group of all Formal Finite Sums over Integer Ring
sage: A.left_domain()
Rational Field
sage: A.codomain()
Traceback (most recent call last):
...
RuntimeError: This action acted on a set that became garbage collected
}}}
Hence, If I understand correctly, the "Formal Finite Sums over Rational
Field" became garbage collected.
And that's where action differ from maps:
- In the case of coercion maps, we have domain and codomain, which
together are used as weak cache keys for the map. Hence, if either domain
or codomain become garbage, then the map becomes invalid but is
immediately removed from the cache and will thus not hurt.
- In the case of actions, we have left domain and right domain, which
together are used as weak cache keys for the action. However, in addition
to the two domains, an action has a codomain, which currently is weak
referenced (this was in order to fix some memory leak). If the codomain is
distinct from both left and right domain and if the codomain becomes
garbage, then the action becomes invalid, but it would NOT be removed from
the cache, as long as domain and codomain are no garbage.
I am afraid that having a strong reference to the codomain of all actions
will re-introduce a memory leak fixed elsewhere. But in the above
analysis, you may notice that there only is a problem if the codomain is
distinct from both left and right domain. Hence, we could be clever and
have a strong reference to the codomain ''only'' in this case, and a weak
reference otherwise.
I will try this now...
--
Ticket URL: <http://trac.sagemath.org/ticket/14711#comment:63>
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.
For more options, visit https://groups.google.com/groups/opt_out.