[Numpy-discussion] allocated memory cache for numpy

Sturla Molden sturla.molden at gmail.com
Tue Feb 18 04:39:06 EST 2014

Julian Taylor <jtaylor.debian at googlemail.com> wrote:
> I was thinking of something much simpler, just a layer of pointer stacks
> for different allocations sizes, the larger the size the smaller the
> cache with pessimistic defaults.
> e.g. the largest default cache layer is 128MB and with one or two
> entries so we can cache temporal close operations like a + (c * b).
> Maybe an age counter can be included that clears the largest old entry
> if it hasn't been used for X allocations.

It would not be difficult if we e.g. used two heaps instead of one. One
would sort the cached blocks according to size (similar to malloc), the
other would be a priority queue for age. Every now and then the expired
entries would be cleared off the cache. 


More information about the NumPy-Discussion mailing list