{"id":16805697,"url":"https://github.com/gcarq/collam","last_synced_at":"2025-08-29T17:23:42.755Z","repository":{"id":148726626,"uuid":"229140243","full_name":"gcarq/collam","owner":"gcarq","description":"A naive and thread safe general-purpose allocator written in Rust built with #[no_std].","archived":false,"fork":false,"pushed_at":"2023-05-29T14:47:15.000Z","size":196,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-11T00:45:57.409Z","etag":null,"topics":["allocator","rust"],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/gcarq.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":"2019-12-19T21:17:57.000Z","updated_at":"2023-05-29T14:47:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"f130ccad-180b-4d15-b8e9-d1e423f78423","html_url":"https://github.com/gcarq/collam","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/gcarq%2Fcollam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcarq%2Fcollam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcarq%2Fcollam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcarq%2Fcollam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gcarq","download_url":"https://codeload.github.com/gcarq/collam/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248322605,"owners_count":21084336,"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","rust"],"created_at":"2024-10-13T09:49:03.352Z","updated_at":"2025-04-11T00:46:03.008Z","avatar_url":"https://github.com/gcarq.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# collam\n[![Build Status](https://travis-ci.org/gcarq/collam.svg?branch=master)](https://travis-ci.org/gcarq/collam) [![Coverage Status](https://coveralls.io/repos/github/gcarq/collam/badge.svg?branch=master)](https://coveralls.io/github/gcarq/collam?branch=master)\n\nA naive and thread safe general-purpose allocator written in Rust built with `#[no_std]`.\nThis project started as an experiment to get comfortable with `#[no_std]` environments and `unsafe` Rust.\nThis library is currently *NOT* stable and I'm sure there are plenty of bugs, be warned!\n\n## A note on its state\nCollam implements the `GlobalAlloc` trait and can be used within Rust.\nThe sub-crate `posix` exposes `malloc`, `calloc`, `realloc`, `free`, `malloc_usable_size`, `mallopt` and can be used for arbitrary programs,\nin its current state its working with almost all tested programs using `LD_PRELOAD`.\n\n## Tested platforms\n[x] Linux x86_64\n\n## Implementation details\nBookkeeping is currently done with an intrusive doubly linked list.\nThe overhead for each use allocated block is 16 bytes whereas only 12 bytes of them are used.\n\n## Performance\nIn regards of memory usage/overhead it is comparable to dlmalloc with tested applications,\nhowever the performance is not there yet.\n\n## Usage within Rust\n```rust\nuse collam::alloc::Collam;\n\n#[global_allocator]\nstatic ALLOC: Collam = Collam::new();\n\nfn main() {\n    let mut vec = Vec::new();\n    vec.push(42);\n    assert_eq!(vec.pop().unwrap(), 42);\n}\n```\n\n## Testing collam in C/POSIX environment\nMake sure you have Rust nightly.\nManually overwrite default allocator:\n```bash\n$ cargo build --manifest-path posix/Cargo.toml --release\n$ LD_PRELOAD=\"$(pwd)/posix/target/release/libcollam.so\" kwrite\n```\nOr use the test script in the root folder:\n```bash\n$ ./scripts/test.sh kwrite\n```\nThere are some more helper scripts for debugging, profiling, etc. See `scripts/` folder.\n\n## Execute tests\nTests are not thread safe, make sure to force 1 thread only!\n```bash\n$ cargo test --all-features -- --test-threads 1\n```\n\n## TODO:\n* Proper Page handling\n* mmap support\n* Thread-local allocation\n* Logarithmic-time complexity allocation\n* Support for different architectures\n* Proper logging","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgcarq%2Fcollam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgcarq%2Fcollam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgcarq%2Fcollam/lists"}