{"id":22870149,"url":"https://github.com/thehxdev/libarena","last_synced_at":"2025-04-14T15:35:31.877Z","repository":{"id":267927951,"uuid":"898130044","full_name":"thehxdev/libarena","owner":"thehxdev","description":"Single-header Arena allocator library with multi-buffer support","archived":false,"fork":false,"pushed_at":"2025-02-06T13:13:35.000Z","size":13,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T04:30:16.225Z","etag":null,"topics":["allocator","c","memory","memory-allocator"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thehxdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-12-03T20:57:21.000Z","updated_at":"2025-03-05T08:58:46.000Z","dependencies_parsed_at":"2024-12-13T10:20:35.993Z","dependency_job_id":"144c4525-6b79-4582-bd69-1d4241d027ab","html_url":"https://github.com/thehxdev/libarena","commit_stats":null,"previous_names":["thehxdev/libarena"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thehxdev%2Flibarena","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thehxdev%2Flibarena/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thehxdev%2Flibarena/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thehxdev%2Flibarena/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thehxdev","download_url":"https://codeload.github.com/thehxdev/libarena/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248906928,"owners_count":21181245,"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":["allocator","c","memory","memory-allocator"],"created_at":"2024-12-13T13:13:56.484Z","updated_at":"2025-04-14T15:35:31.859Z","avatar_url":"https://github.com/thehxdev.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Libarena\nEasy to use, cross-platform and Single-header Arena allocator.\n\n## API\nApplication programming interface for `libarena`.\n\n### Include `arena.h`\nSince the library is single-header, include `arena.h` file in **_JUST ONE SOURCE FILE_** with `LIBARENA_ARENA_IMPLEMENTATION` defined.\nIf you want Multi-Buffer support, define `LIBARENA_MULTI_BUFFER` too in that source file just **_once_**.\nYou can include `arena.h` in all source files. But the implementation details MUST be in one file.\n```c\n// include the implementation\n#define LIBARENA_ARENA_IMPLEMENTATION\n// enable multi-buffer support\n#define LIBARENA_MULTI_BUFFER\n#include \"arena.h\"\n```\nYou can use multi-buffer mode if you want growable buffers. otherwise one fixed buffer will be used.\n\n### Construct a new `Arena_t`\nConstruct a new `Arena_t` instance. This type holds and manages all information about your arena.\n`arena_new` function accepts buffer's size. The default size is one page size (4096 bytes).\nSince `libarena` uses `mmap` on \\*nix systems and `VirtualAlloc` on windows, it's better to use the default size.\n```c\n// pass 0 to use default size\nArena_t a = arena_new(0);\n```\n\n### Allocate memory\nAllocate on arena and get a pointer.\n```c\n// allocate 10 integers\nint *xs = arena_alloc(\u0026a, sizeof(int) * 10);\n```\n\n### Clear arena\nClear and reset arena.\n```c\narena_clear(\u0026a);\n```\n\n### Destroy arena\nDestroy the arena and deallocate all allocated memory.\n```c\narena_destroy(\u0026a);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthehxdev%2Flibarena","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthehxdev%2Flibarena","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthehxdev%2Flibarena/lists"}