#4935: is_perfect_power leaks
----------------------+-----------------------------------------------------
 Reporter:  mabshoff  |        Owner:  robertwb
     Type:  defect    |       Status:  new     
 Priority:  major     |    Milestone:  sage-3.3
Component:  memleak   |   Resolution:          
 Keywords:            |  
----------------------+-----------------------------------------------------
Comment (by robertwb):

 Hmm... perhaps it's just the integer pool filling up?

 {{{
 sage: get_memory_usage()
 '415M'
 sage: time len([a for a in srange(10**6) if not
 (-a^3).is_perfect_power()])
 CPU times: user 5.68 s, sys: 1.01 s, total: 6.69 s
 Wall time: 9.47 s
 241224
 sage: get_memory_usage()
 '431M'
 sage: time len([a for a in srange(10**6) if not
 (-a^3).is_perfect_power()])
 CPU times: user 5.55 s, sys: 0.90 s, total: 6.45 s
 Wall time: 6.53 s
 241224
 sage: get_memory_usage()
 '431M'
 sage: time len([a for a in srange(10**6) if not
 (-a^3).is_perfect_power()])
 CPU times: user 5.58 s, sys: 0.92 s, total: 6.50 s
 Wall time: 6.58 s
 241224
 sage: get_memory_usage()
 '431M'
 }}}

 And a fresh start

 {{{
 ----------------------------------------------------------------------
 | Sage Version 3.2.2, Release Date: 2008-12-18                       |
 | Type notebook() for the GUI, and license() for information.        |
 ----------------------------------------------------------------------
 Loading Sage library. Current Mercurial branch is: bugs
 sage: get_memory_usage()
 '415M'
 sage: time len(srange(10**6))
 CPU times: user 0.40 s, sys: 0.16 s, total: 0.56 s
 Wall time: 0.57 s
 1000000
 sage: get_memory_usage()
 '431M'
 }}}

 So it's something in srange or the integer pool or something... Or the
 fact that the large number of objects that all get allocated at the same
 time enlarge the heap (and it never gives it back).

 {{{
 sage: get_memory_usage()
 '415M'
 sage: len(ZZ.range(10^6))
 1000000
 sage: get_memory_usage()
 '431M'
 }}}

 Also

 {{{
 sage: get_memory_usage()
 '415M'
 sage: time len([True for a in (1..10**6) if not
 (-a^3).is_perfect_power()])
 CPU times: user 9.90 s, sys: 0.96 s, total: 10.86 s
 Wall time: 10.98 s
 241225
 sage: get_memory_usage()
 '415M'
 }}}

 shows that is_perfect_power is clean, so I think it's just a heap with a
 million live elements that doesn't shrink back down when the list is
 freed.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4935#comment:5>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of 
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
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