{"id":13670608,"url":"https://github.com/philip-wernersbach/memory-pool-allocator","last_synced_at":"2026-01-22T20:41:14.697Z","repository":{"id":12962593,"uuid":"15640977","full_name":"philip-wernersbach/memory-pool-allocator","owner":"philip-wernersbach","description":"C memory allocator based on pools, thread safe.","archived":false,"fork":false,"pushed_at":"2014-01-05T23:47:14.000Z","size":168,"stargazers_count":15,"open_issues_count":1,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-11T08:42:05.539Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/philip-wernersbach.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":"2014-01-04T22:43:09.000Z","updated_at":"2024-10-04T03:09:53.000Z","dependencies_parsed_at":"2022-09-06T10:50:44.193Z","dependency_job_id":null,"html_url":"https://github.com/philip-wernersbach/memory-pool-allocator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philip-wernersbach%2Fmemory-pool-allocator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philip-wernersbach%2Fmemory-pool-allocator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philip-wernersbach%2Fmemory-pool-allocator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philip-wernersbach%2Fmemory-pool-allocator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/philip-wernersbach","download_url":"https://codeload.github.com/philip-wernersbach/memory-pool-allocator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251145650,"owners_count":21543075,"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":[],"created_at":"2024-08-02T09:00:46.186Z","updated_at":"2026-01-22T20:41:14.648Z","avatar_url":"https://github.com/philip-wernersbach.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"pmpa - Phil's Memory Pool Allocator\n=====================\n\nC memory allocator based on pools, thread safe.\n\nFeatures\n---------------------\n* Simple \u0026 Fast\n * Less than 200 lines of C code\n* Pool-based allocation\n* Automatically defragments the pool in a deterministic fashion, without the need for garbage collection\n* Lockless, thread-safe design\n * Each thread gets its own memory pool\n* No limit on memory pool or allocation sizes\n* Implements all C memory allocation functions\n* Optional drop-in mode so that you don't have to change your code\n* Comprehensive benchmark \u0026 test suites\n* Permissively licensed: Dual-licensed under the Public Domain and the Unlicense\n * Choose the one that you prefer\n\nHow to Use\n---------------------\n**Regular Mode**\n\n1. Compile `pmpa.c` into your program.\n2. Include `pmpa.h` in your program.\n3. Define `ARCH_64BIT` or `ARCH_32BIT`, depending on your architecture.\n4. Use `pmpa_init_thread()` in each thread that will use pmpa, **before** you allocate memory with pmpa.\n * Example: If your program is going to allocate a maximum of 64kb of memory, use `pmpa_init_thread(65536)`.\n * The actual allocatable memory will be slightly less than what's specified, due to pmpa using some memory for pool accounting.\n5. Use the `pmpa_*` versions of the C memory allocation functions.\n * Example: Use `pmpa_malloc()` where you would use `malloc()`, etc.\n6. Use `pmpa_uninit_thread()` in each thread when the thread is done using pmpa.\n\n**Drop-in Mode**\n\n1. Follow all of the steps in Regular Mode until step 5.\n2. Define `PMPA_OVERRIDE_C_MEMORY_FUNCTIONS` in your program\n * This define causes pmpa to override the standard C memory allocation functions with the `pmpa_*` ones.\n3. Follow step 6.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilip-wernersbach%2Fmemory-pool-allocator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphilip-wernersbach%2Fmemory-pool-allocator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilip-wernersbach%2Fmemory-pool-allocator/lists"}