#15367: Empty lists while creating parents
---------------------------+-------------------------
       Reporter:  roed     |        Owner:
           Type:  defect   |       Status:  new
       Priority:  major    |    Milestone:  sage-5.13
      Component:  memleak  |   Resolution:
       Keywords:           |    Merged in:
        Authors:           |    Reviewers:
Report Upstream:  N/A      |  Work issues:
         Branch:           |       Commit:
   Dependencies:           |     Stopgaps:
---------------------------+-------------------------

Comment (by afiori):

 There is a comment in:
 parent.pyx:2196
 {{{
 if self._coerce_from_hash is None: # this is because parent.__init__()
 does not always get called
             self.init_coerce(False)
 }}}
 that suggests that we can't rely on init to actually be responsible for
 allocating anything. Consequently, throughout parent.pyx and
 parent_old.pyx most of the time we use any of
   _action_hash, _has_coerce_map_from, _coerce_from_hash,
 _convert_from_hash
 we check if they have been allocated yet. (There may be places where we
 don't check... which I suppose would be a bug).

 This suggests the following fix:
    Never allocate any of these, unless we intend to put something in them.
 We already need to check if these are unallocated, if they are... we can
 safely assume they are empty and not create them unless we are about to
 put something in them. We can also make the eventual start size for them
 smaller.

 This may even speed up execution if these lists are typically empty, as
 looking to see if an empty list contains something will be slower than
 checking that the list doesn't even exist yet (especially as we already
 check if the list doesn't exist yet).

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

Reply via email to