[Numpy-discussion] Strange memory consumption in numpy?
martin.raspaud at smhi.se
Thu May 16 08:32:09 EDT 2013
On 16/05/13 10:26, Robert Kern wrote:
>> Can anyone give a reasonable explanation ?
> memory_profiler only looks at the amount of memory that the OS has
> allocated to the Python process. It cannot measure the amount of
> memory actually given to living objects. Python does not always return
> memory back to the OS immediately when it frees the memory for an
> object. Your two observations are linked. Python freed the memory of
> arr2 immediately, but it did not return the memory to the OS, so
> memory_profiler could not notice it. When arr3 is allocated, it
> happened to fit into the block of memory that arr2 once owned, so
> Python's memory allocator just used that block again. Since Python did
> not have to go out to the OS to get more memory, memory_profiler could
> not notice that, either.
Thanks a lot for the clear explanation, it makes perfect sense now.
You're talking about living objects, but as I understand the few memory
profilers I found around the web for python can't track numpy arrays.
Any pointers on something that would work with numpy ?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 303 bytes
Desc: not available
More information about the NumPy-Discussion