#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:  Reported upstream. Developers acknowledge bug.  |     
Reviewers:          
        Authors:                                                  |     Merged 
in:          
   Dependencies:                                                  |      
Stopgaps:          
------------------------------------------------------------------+---------

Comment (by nbruin):

 Replying to [comment:51 SimonKing]:
 > Replying to [comment:50 nbruin]:
 > > It seems to be a value for configure:
 > > {{{
 > >  --with-malloc=system|dlmalloc|gmalloc|pmalloc|external
 > > }}}
 > Then the question arises: Why is it not enough to pass the `--with-
 malloc=system` to Singular? Why did the additional changes become
 necessary that you made on five files in `src/omalloc/`?

 I think I can explain that: omalloc is written to work ''on top of''
 another memory manager. It doesn't call `mmap` or `sbrk` by itself. So I
 think this option selects which malloc is used to serve omalloc with
 pages.

 `dlmalloc` is simply a full-fledged memory manager that happens to be
 shipped with omalloc and can be used as a backend. If you look in
 `dlmalloc.c`, there is actually an implementation of `malloc_usable_size`.
 So I guess you can build omalloc in a way that is independent of the
 malloc offered by the clib and just uses system calls to `mmap` or `sbrk`
 directly.

 The ''other'' configuration options (you'll have to read up on it to be
 sure) deal with what services omalloc provides and how it does it.

 There's an option that selects whether omalloc should offer the standard
 'malloc/realloc/free' interface to its own allocators.

 There is also an option that selects how omalloc does its job: whether it
 should do what it is designed for or whether it should just honour the
 requests it receives by passing them on 1-1 to the underlying memory
 allocator. That's the option that had fallen into disuse within singular
 and had become defunct. I tried to bring its functionality back to the
 level required for singular. I hacked my way to getting omalloc to compile
 in that mode. However, I'm sure this can be done in a nicer fashion.

 > For example, you edited `src/omalloc/omAllocDecl.h` to make the
 emulation unconditional. Is that really needed, if there is a
 configuration option anyway?

 No I'm sure it's not. I didn't figure out a way that positively confirmed
 for me that just passing in an option helped (partially because I couldn't
 interact directly with the singular configure script: the spkg-install
 plays games too in order to build both an executable and libsingular). But
 someone more familiar with how configure and conditional compilation
 setups usually work can probably very easily put that in order.

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