{"id":24310308,"url":"https://github.com/inaccel/numpy-allocator","last_synced_at":"2025-09-26T15:31:37.464Z","repository":{"id":57447302,"uuid":"352971275","full_name":"inaccel/numpy-allocator","owner":"inaccel","description":"Configurable memory allocations","archived":false,"fork":false,"pushed_at":"2024-10-07T08:07:36.000Z","size":49,"stargazers_count":14,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-15T04:35:38.596Z","etag":null,"topics":["numpy","python"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/inaccel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-30T11:08:27.000Z","updated_at":"2024-11-28T16:34:58.000Z","dependencies_parsed_at":"2023-01-22T06:45:49.159Z","dependency_job_id":null,"html_url":"https://github.com/inaccel/numpy-allocator","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaccel%2Fnumpy-allocator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaccel%2Fnumpy-allocator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaccel%2Fnumpy-allocator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaccel%2Fnumpy-allocator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inaccel","download_url":"https://codeload.github.com/inaccel/numpy-allocator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234173193,"owners_count":18790980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["numpy","python"],"created_at":"2025-01-17T06:11:09.923Z","updated_at":"2025-09-26T15:31:32.161Z","avatar_url":"https://github.com/inaccel.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Memory management in [NumPy](https://numpy.org)*\n\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/inaccel/numpy-allocator/master?labpath=NumPy-Allocator.ipynb)\n[![PyPI version](https://badge.fury.io/py/numpy-allocator.svg)](https://badge.fury.io/py/numpy-allocator)\n\n**NumPy is a trademark owned by [NumFOCUS](https://numfocus.org).*\n\n#### Customize Memory Allocators\n\nΑ metaclass is used to override the internal data memory routines. The metaclass has four optional fields:\n\n```python\n\u003e\u003e\u003e import ctypes\n\u003e\u003e\u003e import ctypes.util\n\u003e\u003e\u003e import numpy_allocator\n\u003e\u003e\u003e my = ctypes.CDLL(ctypes.util.find_library('my'))\n\u003e\u003e\u003e class my_allocator(metaclass=numpy_allocator.type):\n...     _calloc_ = ctypes.addressof(my.calloc_func)\n...     _free_ = ctypes.addressof(my.free_func)\n...     _malloc_ = ctypes.addressof(my.malloc_func)\n...     _realloc_ = ctypes.addressof(my.realloc_func)\n...\n```\n\n#### An example using the allocator\n\n```python\n\u003e\u003e\u003e import numpy as np\n\u003e\u003e\u003e with my_allocator:\n...     a = np.array([1, 2, 3])\n...\n\u003e\u003e\u003e my_allocator.handles(a)\nTrue\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finaccel%2Fnumpy-allocator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finaccel%2Fnumpy-allocator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finaccel%2Fnumpy-allocator/lists"}