#13447: Make libsingular multivariate polynomial rings collectable
----------------------------------------------------------------+-----------
       Reporter:  nbruin                                        |         
Owner:                                                                          
 
           Type:  defect                                        |        
Status:  needs_work                                                             
  
       Priority:  major                                         |     
Milestone:  sage-5.4                                                            
     
      Component:  memleak                                       |    
Resolution:                                                                     
      
       Keywords:                                                |   Work 
issues:  Understand why sometimes `new_RingWrap` needs an incref and sometimes 
not
Report Upstream:  None of the above - read trac for reasoning.  |     
Reviewers:  Simon King                                                          
     
        Authors:  Nils Bruin, Simon King                        |     Merged 
in:                                                                           
   Dependencies:  #11521                                        |      
Stopgaps:                                                                       
    
----------------------------------------------------------------+-----------

Comment (by SimonKing):

 Replying to [comment:72 nbruin]:
 > Replying to [comment:70 SimonKing]:
 > > I think one potential problem with our current use of `currRingHdl` in
 combination with `rKill` is that we would ''redefine''
 `my_awesome_sage_ring`, hence, we would see the following message on
 stderr:
 > > {{{
 > > // ** redefining my_awesome_sage_ring **
 > > }}}
 > I suspect the records do get cleared, because otherwise Singular would
 leave a dangling pointer around and one would have what is essentially a
 singular ring variable with NULL pointer to a ring or a pointer to
 unallocated memory .
 > If those variables do get properly removed, by the time we have to
 redefine the thing there should be no trace of the original and hence it
 would not be a redefinition.

 I am afraid Singular knows that the mock ring has been defined. OK, that's
 relative to #12313. But it happened when I did
 {{{
 sage: from sage.rings.polynomial.plural import SCA
 sage: E = SCA(QQ, ['x', 'y', 'z'], [0, 1], order = 'degrevlex')
 sage: import gc
 sage: del E
 sage: _ = gc.collect()
 sage: E = SCA(QQ, ['x', 'y', 'z'], [0, 1], order = 'degrevlex')
 }}}
 #12313 is needed to make E collectable.

 Hans didn't answer, but I found out myself:
 `currRingHdl=rFindHdl(currRing,NULL,NULL)`, which could still be NULL. If
 it is NULL, then we may create the mock ring.

 > Are we the only ones ever setting `currRingHdl` or can one write/call
 singular functions that internally will change `currRingHdl`?

 No idea.

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