Skip to main content

Configurable memory allocations

Project description

Memory management in NumPy*

Binder PyPI version

*NumPy is a trademark owned by NumFOCUS.

Customize Memory Allocators

Α metaclass is used to override the internal data memory routines. The metaclass has four optional fields:

>>> import ctypes
>>> import numpy_allocator
>>> my = ctypes.CDLL('libmy.so')
>>> class my_allocator(metaclass=numpy_allocator.type):
...     _calloc_ = my.calloc_func
...     _free_ = my.free_func
...     _malloc_ = my.malloc_func
...     _realloc_ = my.realloc_func
...

An example using the allocator

>>> import numpy as np
>>> with my_allocator:
...     a = np.array([1, 2, 3])
...
>>> my_allocator.handles(a)
True

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

numpy-allocator-1.1.3.tar.gz (10.4 kB view hashes)

Uploaded Source

Built Distributions

numpy_allocator-1.1.3-cp311-cp311-musllinux_1_1_x86_64.whl (35.9 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

numpy_allocator-1.1.3-cp311-cp311-musllinux_1_1_i686.whl (34.5 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ i686

numpy_allocator-1.1.3-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (31.9 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

numpy_allocator-1.1.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (30.4 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

numpy_allocator-1.1.3-cp310-cp310-musllinux_1_1_x86_64.whl (34.9 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

numpy_allocator-1.1.3-cp310-cp310-musllinux_1_1_i686.whl (33.6 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ i686

numpy_allocator-1.1.3-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (31.7 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

numpy_allocator-1.1.3-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (30.2 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

numpy_allocator-1.1.3-cp39-cp39-musllinux_1_1_x86_64.whl (34.3 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

numpy_allocator-1.1.3-cp39-cp39-musllinux_1_1_i686.whl (33.0 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ i686

numpy_allocator-1.1.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (31.2 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

numpy_allocator-1.1.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (29.7 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

numpy_allocator-1.1.3-cp38-cp38-musllinux_1_1_x86_64.whl (35.4 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

numpy_allocator-1.1.3-cp38-cp38-musllinux_1_1_i686.whl (34.1 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ i686

numpy_allocator-1.1.3-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (31.6 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

numpy_allocator-1.1.3-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (30.1 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page