#13731: Fix libsingular memory management
--------------------------------------------------------------+-------------
       Reporter:  nbruin                                      |         Owner:  
rlm     
           Type:  defect                                      |        Status:  
new     
       Priority:  major                                       |     Milestone:  
sage-5.6
      Component:  memleak                                     |    Resolution:  
        
       Keywords:                                              |   Work issues:  
        
Report Upstream:  Fixed upstream, in a later stable release.  |     Reviewers:  
        
        Authors:  Nils Bruin, Simon King                      |     Merged in:  
        
   Dependencies:                                              |      Stopgaps:  
        
--------------------------------------------------------------+-------------

Comment (by nbruin):

 OK, this trick doesn't work. There are calls of the form
 {{{
 omTypeAllocBin(void*, addr, InternalInteger_bin);
 }}}
 which prevent
 and there are calls to `omAllocBin` anyway that only have the bin, not a
 type hint for how much memory should be allocated. So removing bins
 completely will simply not work: you need them at least as a storage
 container for block lengths associated to them.

 Short: The `AllocBin` routines seem to allocate ''from'' a bin, not the
 bin itself. I think you can take this back to libsingular-devel. Hannes
 claims that xalloc is a sufficient omalloc replacement, so he probably has
 a solution to this (which I bet is resurrecting omBin_s and supporting
 rudimentary initialization of it. We only need the sizeW field on these
 things)

 In fact, from the line
 {{{
 omBin slists_bin = omGetSpecBin(sizeof(slists));
 }}}
 I bet that you can declare
 {{{
 typedef struct omBin_s {
   size_t sizeW;
   size_t sizeB;
 } omBin_t;
 typedef omBin_t* omBin;

 static inline omBin omGetSpecBin(S)
 {   omBin bin = (omBin)malloc(sizeof(omBin_t));
     bin->sizeB = S;
     bin->sizeW = S/sizeof(long);
     return bin;
 }

 #define omTypeAllocBin(T,P,B)    P=(T)omAlloc(B->sizeB)
 }}}
 etc.

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