[Numpy-discussion] allocated memory cache for numpy

Julian Taylor jtaylor.debian at googlemail.com
Mon Feb 17 15:20:31 EST 2014


On 17.02.2014 21:16, Sturla Molden wrote:
> Julian Taylor <jtaylor.debian at googlemail.com> wrote:
> 
>> When an array is created it tries to get its memory from the cache and
>> when its deallocated it returns it to the cache.
> 
> Good idea, however there is already a C function that does this. It uses a
> heap to keep the cached memory blocks sorted according to size. You know it
> as malloc — and is why we call this allocation from the heap. Which by the
> way is what NumPy already does.  ;-)
> 

not with glibc, glibc has no cache for mmap allocated memory.
It does cache sbrk allocated memory and uses a dynamic threshold for
using it but its tuned for generic applications so the maximum threshold
is very low, I think its 32 MB. Far too low for many numerical applications.



More information about the NumPy-Discussion mailing list