#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:  fix doctests  |       Upstream:  N/A                
   Reviewer:                |         Author:  Simon King         
     Merged:                |   Dependencies:  #9138, #11900      
----------------------------+-----------------------------------------------

Comment(by SimonKing):

 It turns out that using `TripleDictById` for the _action_maps cache makes
 the segfault disappear.

 If one uses `TripleDict` for _coercion_maps then
 {{{
 sage -t  devel/sage-main/sage/modular/modsym/space.py
 }}}
 takes 30 seconds, but if one also uses `TripleDictById` then it only takes
 23 seconds.

 My conclusion:

  * The old version of `TripleDict` was buggy: It uses `id(...)` for the
 hash table, but `==` for comparison. I think that had to be fixed.
  * The new version of `TripleDict` uses `hash(...)` for the hash table and
 `==` for comparison. That should be fine, but (1) it leads to a segfault
 and (2) it leads to a slowdown. After all, calling `hash(...)` is a lot
 slower than determining the address.
  * The new `TripleDictById` uses `id(...)` for the hash table and `... is
 ...` for comparison. Problem: It would probably not fix the memory leak.

 However, the fact that using `TripleDictById` fixes the segfault makes me
 wonder: Perhaps the segfault occurs when calling `hash(...)` on a parent?
 Namely, in some cases, and action will already be constructed during
 initialisation of a parent. But if the hash is determined based on cdef
 data that aren't initialised, a segfault can easily occur.

 I'll investigate that further. In any case, we need to keep an eye on the
 potential slow-down.

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