{"id":20963840,"url":"https://github.com/codemix/malloc-append","last_synced_at":"2025-06-10T19:37:44.067Z","repository":{"id":68799296,"uuid":"55314992","full_name":"codemix/malloc-append","owner":"codemix","description":"Simple append-only alloc() implementation on top of buffers and array buffers.","archived":false,"fork":false,"pushed_at":"2016-04-02T20:37:12.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-16T21:48:41.594Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/codemix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2016-04-02T20:35:28.000Z","updated_at":"2017-10-15T20:36:25.000Z","dependencies_parsed_at":"2023-05-03T04:00:46.660Z","dependency_job_id":null,"html_url":"https://github.com/codemix/malloc-append","commit_stats":{"total_commits":2,"total_committers":1,"mean_commits":2.0,"dds":0.0,"last_synced_commit":"7e2b28b9df7e2ebca72a8fd0db52fd047535040b"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemix%2Fmalloc-append","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemix%2Fmalloc-append/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemix%2Fmalloc-append/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemix%2Fmalloc-append/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codemix","download_url":"https://codeload.github.com/codemix/malloc-append/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemix%2Fmalloc-append/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259137287,"owners_count":22810663,"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-11-19T02:48:34.639Z","updated_at":"2025-06-10T19:37:44.006Z","avatar_url":"https://github.com/codemix.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# malloc-append\nAn append-only memory allocator with the same interface as [malloc](https://github.com/codemix/malloc), useful for implementing append only logs. Has no `free()` but does not enforce write-once.\n\n[![Build Status](https://travis-ci.org/codemix/malloc-append.svg?branch=master)](https://travis-ci.org/codemix/malloc-append)\n\n## What?\n\nIt lets you allocate a large, contiguous slab of memory up front and then `alloc()` within that buffer.\n\nIt is mostly useful in conjunction with things like [mmap.js](https://github.com/indutny/mmap.js).\n\nIt's developed using [design by contract](https://github.com/codemix/babel-plugin-contracts), so you might find the library's own code style a bit unusual, but it doesn't affect usage or performance.\n\n## Installation\n\nInstall via [npm](https://npmjs.org/package/malloc-append).\n\n## Usage\n\n```js\nimport Allocator from \"malloc-append\";\n\nconst heap = new Buffer(1024 * 1024);\nconst allocator = new Allocator(heap); // heap could also be an ArrayBuffer\nconsole.log(allocator.inspect());\n\nlet firstAddress = 0;\nlet lastAddress = 0;\n\nfor (let i = 0; i \u003c 100; i++) {\n  const address = allocator.alloc(64);\n  if (firstAddress === 0) {\n    firstAddress = address;\n  }\n  if (lastAddress !== 0) {\n    // do something with the address\n    heap.writeUInt32LE(address, lastAddress);\n  }\n}\n\nlet address = firstAddress;\nfor (let i = 0; i \u003c 100; i++) {\n  console.log('Reading address', address);\n  address = heap.readUInt32LE(address);\n}\n\n```\n\n\n## License\n\nPublished by [codemix](http://codemix.com/) under a permissive MIT License, see [LICENSE.md](./LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodemix%2Fmalloc-append","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodemix%2Fmalloc-append","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodemix%2Fmalloc-append/lists"}