#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:  N/A      |     Reviewers:          
        Authors:           |     Merged in:          
   Dependencies:           |      Stopgaps:          
---------------------------+------------------------------------------------

Comment (by nbruin):

 We can also use ElectricFence as a malloc substitute:
 {{{
 $ export LD_PRELOAD=libefence.so
 $ export EF_ALLOW_MALLOC_0=1     #apparently sage/python does a malloc(0)
 somewhere
 $ echo 512000 | sudo tee /proc/sys/vm/max_map_count #efence uses mprotect
 A LOT
 $ ./sage -t --gdb devel/sage/sage/libs/singular/function.pyx
 }}}
 This gives an error in a different location. Traceback:
 {{{
 #0  0x00007fffce9fb3f2 in
 List<CanonicalForm>::isEmpty(this=0x7fffa515b000) at
 ./templates/ftmpl_list.cc:256
 #1  0x00007fffce96a350 in multiFactorize (F=..., v=...) at
 facFactorize.cc:710
 #2  0x00007fffce905e9d in ratSqrfFactorize (v=..., G=...) at
 facFactorize.h:45
 #3  ratFactorize (G=..., v=..., substCheck=<optimized out>) at
 facFactorize.h:125
 #4  0x00007fffce90303c in factorize (f=..., issqrfree=false) at
 cf_factor.cc:651
 #5  0x00007fffce7a5b44 in singclap_factorize (f=0x7fff9e16dfd0,
 v=0x7fffffffb548, with_exps=0) at clapsing.cc:835
 #6  0x00007fffce720d50 in jjFAC_P (res=0x7fff9e16ffc0, u=0x7fff9ea7afc0)
 at iparith.cc:3995
 #7  0x00007fffce729c42 in iiExprArith1 (res=0x7fff9e16ffc0,
 a=0x7fff9ea7afc0, op=424) at iparith.cc:7869
 #8  0x00007fffce12df55 in
 
__pyx_f_4sage_4libs_8singular_8function_17KernelCallHandler_handle_call(__pyx_v_self=0x7fff9e967b48,
 __pyx_v_argument_list=0x7fff9e975b40, __pyx_optional_args=<optimized out>)
 at sage/lib/singular/function.cpp:11286
 }}}
 All these error point in the same direction, though: As soon as we start
 interacting with the singular ''interpreter'' we get exposed to whatever
 memory management it does and we're in big trouble. Use of libsingular on
 more basic levels usually doesn't expose us to libsingular memory
 management, so no problems arise.

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