{"id":13438550,"url":"https://github.com/codemix/malloc","last_synced_at":"2025-07-14T16:05:10.694Z","repository":{"id":61838399,"uuid":"46308729","full_name":"codemix/malloc","owner":"codemix","description":"Simple malloc() \u0026 free() implementation for node.js, built on top of array buffers.","archived":false,"fork":false,"pushed_at":"2016-02-10T23:47:06.000Z","size":41,"stargazers_count":25,"open_issues_count":2,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-23T18:50:39.244Z","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}},"created_at":"2015-11-16T23:02:54.000Z","updated_at":"2025-01-12T02:03:14.000Z","dependencies_parsed_at":"2022-10-22T04:45:20.242Z","dependency_job_id":null,"html_url":"https://github.com/codemix/malloc","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/codemix/malloc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemix%2Fmalloc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemix%2Fmalloc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemix%2Fmalloc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemix%2Fmalloc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codemix","download_url":"https://codeload.github.com/codemix/malloc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemix%2Fmalloc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265314164,"owners_count":23745208,"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-07-31T03:01:06.387Z","updated_at":"2025-07-14T16:05:10.669Z","avatar_url":"https://github.com/codemix.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# malloc\nA skip-list based memory allocator built on top of typed arrays (and node buffers).\n\n[![Build Status](https://travis-ci.org/codemix/malloc.svg?branch=master)](https://travis-ci.org/codemix/malloc)\n\n## What?\n\nIt lets you allocate a large, contiguous slab of memory up front and then `alloc()` and `free()` within that buffer.\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.\n\n## Installation\n\nInstall via [npm](https://npmjs.org/package/malloc).\n\n## Usage\n\n```js\nimport Allocator from \"malloc\";\n\nconst heap = new Buffer(1024 * 1024);\nconst allocator = new Allocator(heap); // heap could also be an ArrayBuffer\nconsole.log(allocator.inspect());\n\nconst input = \"Hello World\";\nconst offset = allocator.alloc(Buffer.byteLength(input));\nheap.write(input, offset);\n\nconsole.log(allocator.inspect());\n\nconsole.log(allocator.sizeOf(offset));\n\nconsole.log('freed', allocator.free(offset), 'bytes');\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","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodemix%2Fmalloc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodemix%2Fmalloc/lists"}