#10963: More functorial constructions
-------------------------------------+-------------------------------------
Reporter: nthiery | Owner: stumpc5
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-6.1
Component: categories | Resolution:
Keywords: days54 | Merged in:
Authors: Nicolas M. Thiéry | Reviewers: Simon King, Frédéric
Report Upstream: N/A | Chapoton
Branch: | Work issues: Detect and fix
public/ticket/10963 | Heisenbugs
Dependencies: #11224, #8327, | Commit:
#10193, #12895, #14516, #14722, | 8eaf51a82c4e2194769db13457979ae601ebbc04
#13589, #14471, #15069, #15094, | Stopgaps:
#11688, #13394, #15150, #15506 |
-------------------------------------+-------------------------------------
Comment (by nbruin):
Replying to [comment:261 SimonKing]:
> No, it is not a memory leak. The stored items are formed by classes that
are defined in modules anyway.
Not for things that get fed to it for which it's designed. Does it always
raise an error if it gets something else? It could leak that. So
(especially when you scribbe in the cache beforehand) you'll have to
ensure that the cache is cleansed of undesirable things.
> > In addition, `_base_category_and_axiom` is a lazy class attribute, so
it has a cache of its own. Why are we caching things twice?
> When making this function an uncached function (thus relying on the lazy
attribute), and hence when removing the hack with temporarily filling the
cache, one gets this many calls of `base_category_class_and_axiom(cls)`,
sorted by `cls`:
> ...
> So, it may be a hack, but what else do you suggest to avoid this high
number of function calls?
That's just the bug we had before. If you remove the assertion the
recursion is also avoided and you'll see a much lower number of calls. The
bug here is that executing `base_category_and_axiom` (or rather the
assert) apparently queries the attribute `_base_category_and_axiom`.
That's bad, so don't do that. That's exactly what I mean with using a
cache to cover up flawed programming logic.
Basically, the whole use of `base_category_class_and_axiom` is
questionable. Categories shoud just define a `_base_category_and_axiom`
attribute outright. As far as `base_category_class_and_axiom` is
concerned, the value is a function of only their name anyway. It's just a
tool to save (a small amount of) typing, and as we're seeing, causing
nasty problems while trying to do it.
--
Ticket URL: <http://trac.sagemath.org/ticket/10963#comment:263>
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.