{"id":15364471,"url":"https://github.com/xadillax/xmempool","last_synced_at":"2025-04-15T07:30:58.961Z","repository":{"id":24306222,"uuid":"27701844","full_name":"XadillaX/xmempool","owner":"XadillaX","description":"🛀 A memory pool implemented by C.","archived":false,"fork":false,"pushed_at":"2024-10-15T03:38:51.000Z","size":1259,"stargazers_count":14,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T18:14:47.243Z","etag":null,"topics":["c","memory-pool"],"latest_commit_sha":null,"homepage":"https://xadillax.github.io/xmempool/html","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/XadillaX.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-12-08T06:49:45.000Z","updated_at":"2024-10-29T09:39:08.000Z","dependencies_parsed_at":"2024-11-08T10:02:37.239Z","dependency_job_id":"12c06375-245f-4c45-bfef-94d12c4bb9a0","html_url":"https://github.com/XadillaX/xmempool","commit_stats":{"total_commits":59,"total_committers":4,"mean_commits":14.75,"dds":0.0847457627118644,"last_synced_commit":"bf5ec1e958c27195b0ffec2121a64e2b80ad9802"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XadillaX%2Fxmempool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XadillaX%2Fxmempool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XadillaX%2Fxmempool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XadillaX%2Fxmempool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/XadillaX","download_url":"https://codeload.github.com/XadillaX/xmempool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249026699,"owners_count":21200493,"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":["c","memory-pool"],"created_at":"2024-10-01T13:11:51.866Z","updated_at":"2025-04-15T07:30:58.510Z","avatar_url":"https://github.com/XadillaX.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# X Memo Pool\n\nA memory pool implemented by C.\n\n## Overview\n\nX Memo Pool is a lightweight and efficient memory management solution designed to optimize memory allocation and deallocation in C programs. It provides a pool-based approach to memory management, which can significantly improve performance in scenarios where frequent allocations of fixed-size blocks are required.\n\n\u003e Note: Sharing a single pool across multiple threads is not recommended for thread safety.\n\n## Features\n\n- Fast allocation and deallocation of fixed-size memory blocks\n- Automatic pool expansion when the current pool is exhausted\n- Zero-initialization of allocated blocks\n- Easy-to-use API with creation, allocation, freeing, and destruction functions\n- Debugging support with pool information printing\n\n## Usage\n\n### Creating a Pool\n\nTo start using X Memo Pool, first create a pool handler for your data structure:\n\n```c\nxmem_pool_handle xmem_create_pool(uint32_t block_size);\n```\n\nExample:\n\n```c\ntypedef struct {\n    int  id;\n    char str[16];\n} my_struct;\n\nxmem_pool_handle pool = xmem_create_pool(sizeof(my_struct));\nif (!pool) {\n    printf(\"Failed to create memory pool\\n\");\n}\n```\n\n### Allocating Memory\n\nTo allocate a block from the pool:\n\n```c\nchar* xmem_alloc(xmem_pool_handle handle);\n```\n\nExample:\n\n```c\nmy_struct* data = (my_struct*)xmem_alloc(pool);\nif (!data) {\n    printf(\"Failed to allocate memory from pool\\n\");\n}\n```\n\n### Freeing Memory\n\nTo return a block to the pool:\n\n```c\nint xmem_free(xmem_pool_handle handle, char* pointer);\n```\n\nExample:\n\n```c\nint result = xmem_free(pool, (char*)data);\nif (!result) {\n    printf(\"Failed to free memory\\n\");\n}\n```\n\n### Destroying the Pool\n\nTo destroy the entire pool and free all associated resources:\n\n```c\nvoid xmem_destroy_pool(xmem_pool_handle pool);\n```\n\nExample:\n\n```c\nxmem_destroy_pool(pool);\n```\n\n### Additional Functions\n\nFor more detailed information about the API, please refer to the [xmempool.h](xmempool.h) header file.\n\n## Performance\n\nTo run performance tests:\n\n1. Install dependencies:\n   ```\n   npm install\n   ```\n\n2. Run the performance script:\n   ```\n   node perf.js\n   ```\n\nThe performance report will be generated in the `./perf/report` directory.\n\n## Contributing\n\nContributions to X Memo Pool are welcome! Feel free to submit pull requests or open issues for bugs, feature requests, or improvements.\n\n## License\n\nX Memo Pool is open-source software. Please refer to the [LICENSE](LICENSE) file for detailed licensing information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxadillax%2Fxmempool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxadillax%2Fxmempool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxadillax%2Fxmempool/lists"}