#13387: Improve MonoDict and TripleDict data structures
----------------------------------+-----------------------------------------
       Reporter:  nbruin          |         Owner:  Nils Bruin                  
  
           Type:  enhancement     |        Status:  needs_review                
  
       Priority:  major           |     Milestone:  
sage-duplicate/invalid/wontfix
      Component:  memleak         |    Resolution:                              
  
       Keywords:                  |   Work issues:                              
  
Report Upstream:  N/A             |     Reviewers:                              
  
        Authors:  Nils Bruin      |     Merged in:                              
  
   Dependencies:  #11521, #12313  |      Stopgaps:                              
  
----------------------------------+-----------------------------------------

Comment (by nbruin):

 Incidentally, doing a `del` on a bucket slice is indeed safe: Python
 defers DECREF activity until the slice has been removed from the list.
 Also, since the slices we delete are not longer than 8 entries, the
 temporary references are kept on the stack (faster!). See
 
[http://hg.python.org/releasing/2.7.3/file/7bb96963d067/Objects/listobject.c#l614
 Objects/listobject.c:614]. That means the deletion routines as proposed
 should be safe, also in view of callbacks.

 The only scenario that would lead to undue deletions due to callback would
 be if a callback on a key with `id=I` gets delayed until a new object with
 the same `id` `I` gets stored in the same dictionary. However, that would
 need an object to get ''deallocated'' before its callbacks get executed or
 scrapped. That seems like a real violation of protocol.

 For the truly paranoid, we could check in the `Eraser` classes that the
 weakref corresponding to the callback is indeed NULL-ed. However, I'd be
 shocked if that were necessary.

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


Reply via email to