#12985: Possible future issues with ECL build with unicode enabled
------------------------------------------------------------------+---------
       Reporter:  pcpa                                            |         
Owner:  was     
           Type:  enhancement                                     |        
Status:  new     
       Priority:  minor                                           |     
Milestone:  sage-5.1
      Component:  interfaces                                      |    
Resolution:          
       Keywords:                                                  |   Work 
issues:          
Report Upstream:  Reported upstream. Developers deny it's a bug.  |     
Reviewers:          
        Authors:                                                  |     Merged 
in:          
   Dependencies:                                                  |      
Stopgaps:          
------------------------------------------------------------------+---------

Comment (by nbruin):

 Juan's of course right in being concerned that objects are protected
 against garbage collection while alive. As far as I know, Boehm does watch
 the C stack for pointers, so a local variable pointing to the string
 should protect it against garbage collection while in scope.

 I'm pretty sure that every `ecl_base_string_pointer_safe` occurs in a
 context where a python string object is required. Cython injects a
 `PyBytes_FromString` for that, which copies the content into a Python
 allocated object. The ECL-managed object is thus extremely short lived and
 during its life, is referenced by a local C variable (i.e., is referenced
 on the C stack). Boehm is supposed to watch the C stack for references, so
 it is protected against GC during its life.

 If the reference returned by `ecl_base_string_pointer_safe` were to be
 stored in, say, a malloc'd location (or Python managed memory) such
 protection is no longer guaranteed. This is why `EclObject.set_obj` makes
 the little `remove_node`/`insert_node_after` dance, which ensures that a
 reference to the underlying ecl-object is stored within memory watched by
 Boehm-GC.

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