#13447: Make libsingular multivariate polynomial rings collectable
---------------------------+------------------------------------------------
       Reporter:  nbruin   |         Owner:  rlm     
           Type:  defect   |        Status:  new     
       Priority:  major    |     Milestone:  sage-5.4
      Component:  memleak  |    Resolution:          
       Keywords:           |   Work issues:          
Report Upstream:  N/A      |     Reviewers:          
        Authors:           |     Merged in:          
   Dependencies:           |      Stopgaps:          
---------------------------+------------------------------------------------

Comment (by nbruin):

 OK, I did a little experiment and tried to build singular with plain
 malloc rather than omalloc. In principle, omalloc has an `--with-
 emulate...` flag, but the API offered in that mode is woefully incomplete
 for singular use. I tried to extend it a little. Very rough result:

 [http://sage.math.washington.edu/home/nbruin/singular-3-1-5.malloc.spkg]

 One problem is supplying a `memdup`, which needs to know the size of an
 allocated block from its pointer. On BSD, you can use `malloc_size` for
 that. On linux one could use `malloc_usable_size`. The rest is a whole
 swath of routines that need to be supplied.

 The package above is very dirty, but on bsd.math it did provide me with an
 apparently working libsingular. The singular executable produced didn't
 seem usable, so keep your old one!

 The doctest passes! Not exactly what we were hoping for, but it does make
 a double-free unlikely. That would have been detected. Corruption after
 freeing could still be possible, since `malloc` allocates way bigger
 blocks, so freelist data is likely missed.

 There is of course also the possibility of some routine writing out of
 bounds, which is less likely to trigger problems with malloc too.

 Singular people might be interested in incorporating the changes to
 omalloc (and preferrably extend them a little bit) so that `--with-
 emulate...` becomes a viable option for Singular debugging. Then you can
 valgrind singular code.

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