#9863: Error in sage/graphs/genus.pyx on ia64-Linux-suse
-----------------------+----------------------------------------------------
   Reporter:  mpatel   |       Owner:  mvngu   
       Type:  defect   |      Status:  new     
   Priority:  blocker  |   Milestone:  sage-4.6
  Component:  doctest  |    Keywords:          
     Author:           |    Upstream:  N/A     
   Reviewer:           |      Merged:          
Work_issues:           |  
-----------------------+----------------------------------------------------

Comment(by mderickx):

 I think a gc.collect would be a good thing to do right before both of the
 get_memory_usage statements. I think it's even better then my previous
 suggestion to just rename change the second asignment to G in H. The first
 collect would be to make sure the measurements don't get messed up by
 things that where collectable already at the first get_memory_usage()
 statement.

 The second collect would be to make sure that objects not already freed by
 the reference counting, but could be garbage collected still get freed.
 This should be done since these objects also wouldn't account to a memory
 leak.
 I suggest a code similar to the following.
 {{{
 sage: import sage.graphs.genus
 sage: import gc
 sage: G = graphs.CompleteGraph(100)
 sage: G = Graph(G, implementation='c_graph', sparse=False)
 sage: gc.collect()   #random
 54
 sage: t = get_memory_usage()
 sage: for i in xrange(10000):
 ....:     gb =
 sage.graphs.genus.simple_connected_genus_backtracker(G._backend._cg)
 ....:     gb = None  #indirect doctest
 ....:
 sage: gc.collect()
 0
 sage: get_memory_usage(t)
 0.0

 }}}

 ps. I added the for loop to make sure that if there really is a memory
 leak, it will be found. As shown in my first remark, the memory used by
 the tested class is insignificant.

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