{"id":27117382,"url":"https://github.com/tsoding/arena","last_synced_at":"2025-05-16T01:04:59.571Z","repository":{"id":91697904,"uuid":"530043335","full_name":"tsoding/arena","owner":"tsoding","description":"Arena Allocator implementation in pure C as an stb-style single-file library.","archived":false,"fork":false,"pushed_at":"2025-04-22T09:02:49.000Z","size":114,"stargazers_count":512,"open_issues_count":0,"forks_count":25,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-29T12:14:49.516Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tsoding.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,"zenodo":null}},"created_at":"2022-08-29T02:46:36.000Z","updated_at":"2025-04-28T22:04:55.000Z","dependencies_parsed_at":"2024-02-22T04:23:15.430Z","dependency_job_id":"237d8f5a-ba29-4642-8218-95194a3e9705","html_url":"https://github.com/tsoding/arena","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/tsoding%2Farena","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsoding%2Farena/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsoding%2Farena/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsoding%2Farena/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tsoding","download_url":"https://codeload.github.com/tsoding/arena/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254448579,"owners_count":22072764,"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":"2025-04-07T06:01:42.991Z","updated_at":"2025-05-16T01:04:59.552Z","avatar_url":"https://github.com/tsoding.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"# Arena Allocator\n\n[Arena Allocator](https://en.wikipedia.org/wiki/Region-based_memory_management) implementation in pure C as an [stb-style single-file library](https://github.com/nothings/stb).\n\n*I just caught myself implementing this over and over again in my projects, so I decided to turn it into a copy-pastable library similar to [sv](http://github.com/tsoding/sv)*\n\n## Quick Start\n\n\u003e The truly reusable code is the one that you can simply copy-paste.\n\nThe library itself does not require any special building. You can simple copy-paste [./arena.h](./arena.h) to your project and `#include` it.\n\n```c\n#define ARENA_IMPLEMENTATION\n#include \"arena.h\"\n\nstatic Arena default_arena = {0};\nstatic Arena temporary_arena = {0};\nstatic Arena *context_arena = \u0026default_arena;\n\nvoid *context_alloc(size_t size)\n{\n    assert(context_arena);\n    return arena_alloc(context_arena, size);\n}\n\nint main(void)\n{\n    // Allocate stuff in default_arena\n    context_alloc(64);\n    context_alloc(128);\n    context_alloc(256);\n    context_alloc(512);\n\n    // Allocate stuff in temporary_arena;\n    context_arena = \u0026temporary_arena;\n    context_alloc(64);\n    context_alloc(128);\n    context_alloc(256);\n    context_alloc(512);\n\n    // Deallocate everything at once\n    arena_free(\u0026default_arena);\n    arena_free(\u0026temporary_arena);\n    return 0;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsoding%2Farena","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftsoding%2Farena","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsoding%2Farena/lists"}