#715: Parents probably not reclaimed due to too much caching
--------------------------------+-------------------------------------------
   Reporter:  robertwb          |          Owner:  somebody           
       Type:  defect            |         Status:  needs_work         
   Priority:  major             |      Milestone:  sage-4.8           
  Component:  coercion          |       Keywords:  weak cache coercion
Work_issues:  avoid regression  |       Upstream:  N/A                
   Reviewer:                    |         Author:  Simon King         
     Merged:                    |   Dependencies:  #9138, #11900      
--------------------------------+-------------------------------------------

Comment(by jpflori):

 Replying to [comment:74 SimonKing]:

 > Replying to [comment:73 jpflori]:
 > > Good point about #11521, I'd say because that what I was firstly
 interested in. Without it applied, the flaky behavior seem to disappear.
 > Good!
 > > I'll post timings with all patches, with all patches except for
 #11521, and with no patches in a few hours.
 > OK, but I guess the timings I provided should be enough to show that the
 patch can not remain as it is now.
 > > Anyway I guess Volker is right and even with just #715 applied we
 should check that actions do not get garbage collected continuously as
 your timings suggest.

 > Yep. Two potential solutions: 1. Find out why apparently not all actions
 are registered in the parent (because then we would have a strong
 reference as long as at least the domain is alive). 2. Play with the idea
 to have a strong reference on the action but a weak reference from a
 functor to its domain and codomain. I'm trying the latter now.

 Just to summarize, here is the current problem, please correct me if some
 of the following is wrong: we want to let a codomain (resp. domain) get
 garbage collected when its only weak reffed outside of the coercion model.

 Before the current patch the situation is as follows for actions:

 - when an action is resolved, it is cached in a triple dict in the
 coercion model with the domain and codomains as keys

 - the action is also cached in the dictionnaries in the domain and the
 codomain much in the same way

 - there is also a similar cache for homsets

 The current patch let weakrefs be used for the keys to the above
 dictionaries and a weak ref to the corresponding value (which is the
 action).

 The problem is that as the action is only weak reffed everywhere now, it
 gets garbage collected all the time (to be confirmed).

 If it is not, then the codomain (resp. domain) will in turn not get
 garbage collected, because it will be strongly reffed in the action
 strongly reffed in the domain (resp. codomain) (to be confirmed).

 The problem for the homset patch is slightly different and is being
 discussed in #11521.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/715#comment:75>
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.

Reply via email to