#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):
No, I don't think this has anything to do with pools or the gmp allocator.
{{{
sage: get_memory_usage()
'415M'
sage: len(range(10^6))
1000000
sage: get_memory_usage()
'423M'
sage: len([float(a) for a in range(10^6)])
1000000
sage: get_memory_usage()
'439M'
sage: len(range(10^7))
10000000
sage: get_memory_usage()
'552M'
}}}
(Note that int objects have a smaller memory footprint than Integers).
My understanding is that when a new, small, object is allocated, the
python memory manager tries to return an already-allocated chunk of the
right size out of the heap. If there isn't one, it needs to grow the heap.
The "leaking" examples all construct huge lists, so the heap grows to the
size of the whole list. When objects are freed, the memory goes back to
the heap, but doesn't get freed (just like the integer pool idea). Usually
this makes sense, as thousands of ephemeral Python objects are used and
collected all the time, and usually the number of objects grows over time.
In our case, if we make another huge list, the memory is sitting there
pre-allocated just waiting to be used.
Large (>256 bytes?) allocations are deferred directly to malloc, as are
user-requested and external library ones, so this kind of memory does get
reclaimed immediately.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4935#comment:7>
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
-~----------~----~----~----~------~----~------~--~---