{"id":46859739,"url":"https://github.com/rajamukherji/ramp","last_synced_at":"2026-03-10T18:10:33.032Z","repository":{"id":98442516,"uuid":"145305345","full_name":"rajamukherji/ramp","owner":"rajamukherji","description":"Raja's Attempt at a Memory Pool","archived":false,"fork":false,"pushed_at":"2024-01-03T04:06:35.000Z","size":63,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-01-03T05:27:31.751Z","etag":null,"topics":["memory-management","pool-allocator"],"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/rajamukherji.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-08-19T13:24:41.000Z","updated_at":"2024-01-03T04:06:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"45cd75a9-8eb1-42b2-87c3-99043ea2e7e8","html_url":"https://github.com/rajamukherji/ramp","commit_stats":null,"previous_names":[],"tags_count":1,"template":null,"template_full_name":null,"purl":"pkg:github/rajamukherji/ramp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rajamukherji%2Framp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rajamukherji%2Framp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rajamukherji%2Framp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rajamukherji%2Framp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rajamukherji","download_url":"https://codeload.github.com/rajamukherji/ramp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rajamukherji%2Framp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30346632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T15:55:29.454Z","status":"ssl_error","status_checked_at":"2026-03-10T15:54:58.440Z","response_time":106,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["memory-management","pool-allocator"],"created_at":"2026-03-10T18:10:30.641Z","updated_at":"2026-03-10T18:10:33.024Z","avatar_url":"https://github.com/rajamukherji.png","language":"C","readme":"# Ramp\nRaja's Attempt at a Memory Pool\n\n## About\n\n`ramp` is a very simple library which provides a non-threadsafe memory pool.\nIt is designed to be used in event based applications written in C, and allows memory to be allocated easily within an event and then freed automatically at the end of the event.\n\nEach `ramp_t` object keeps track of a linked list of pages of memory, with the page size specified at `ramp_t` construction.\nMemory can be allocated from a `ramp_t` object using `ramp_alloc`.\n\n## Building\n\nBuilding `ramp` requires [`rabs`](http://github.com/wrapl/rabs).\n\n```\n$ git clone https://github.com/rajamukherji/ramp\n$ cd ramp\n$ rabs\n```\n\n## Usage\n\nIf the request block of memory is too big to fit into a single page, then an external block of memory is allocated, but still tracked within the `ramp_t`.\n\nAt the beginning of each handling each event, allocated a new `ramp_t` object by calling `ramp_new(size_t PageSize)`.\nThe `PageSize` argument to `ramp_new` sets the size of each new page.\n\n```c\nramp_t *Ramp = ramp_new(512);\n```\n\nDuring the event handling, any number of memory blocks can be allocated using `ramp_alloc(ramp_t *Ramp, size_t Size)`.\n\n```c\nchar *Buffer = ramp_alloc(Ramp, 128);\n```\n\nFinally, after the event is handled, all of the memory allocated with the `ramp_t` instance can be freed using `ramp_clear(ramp_t *Ramp)`.\n\n```c\nramp_clear(Ramp);\n```\n\nIf additional cleanup is required when `ramp_clear()` is called, `ramp_defer(ramp_t *Ramp, size_t Size, void (*CleanupFn)(void *))` can be used instead of `ramp_alloc()`. `CleanupFn()` will be called with the returned pointer when `ramp_clear()` is called.\n\n```c\nvoid object_cleanup(struct object_t *Object) {\n\t// clean up code\n}\n\nstruct object_t *Object = (object_t *)ramp_defer(Ramp, sizeof(object_t), object_cleanup);\n```\n\nThe `ramp_t` instance can be reused if required.\nWhen the `ramp_t` instance is no longer required, it can be freed with `ramp_free(ramp_t *Ramp)`.\n\n```c\nramp_free(Ramp);\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frajamukherji%2Framp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frajamukherji%2Framp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frajamukherji%2Framp/lists"}