{"id":16687782,"url":"https://github.com/alecmocatta/cap","last_synced_at":"2025-04-04T17:07:57.768Z","repository":{"id":49365033,"uuid":"216424241","full_name":"alecmocatta/cap","owner":"alecmocatta","description":"An allocator that can track and limit memory usage.","archived":false,"fork":false,"pushed_at":"2023-03-26T13:45:58.000Z","size":34,"stargazers_count":205,"open_issues_count":2,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-06T22:42:28.345Z","etag":null,"topics":["allocation","bound","limit","memory","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alecmocatta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE.txt","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-10-20T20:37:49.000Z","updated_at":"2024-11-25T04:47:51.000Z","dependencies_parsed_at":"2024-10-25T18:34:01.375Z","dependency_job_id":"4555fb4e-3c14-4635-ba2f-b9e32c04091b","html_url":"https://github.com/alecmocatta/cap","commit_stats":{"total_commits":18,"total_committers":4,"mean_commits":4.5,"dds":"0.38888888888888884","last_synced_commit":"a63589670397f85745daa1a22d2de4d46fd742aa"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecmocatta%2Fcap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecmocatta%2Fcap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecmocatta%2Fcap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecmocatta%2Fcap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alecmocatta","download_url":"https://codeload.github.com/alecmocatta/cap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247217183,"owners_count":20903009,"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":["allocation","bound","limit","memory","rust"],"created_at":"2024-10-12T15:25:01.786Z","updated_at":"2025-04-04T17:07:57.739Z","avatar_url":"https://github.com/alecmocatta.png","language":"Rust","readme":"# cap\n\n[![Crates.io](https://img.shields.io/crates/v/cap.svg?maxAge=86400)](https://crates.io/crates/cap)\n[![MIT / Apache 2.0 licensed](https://img.shields.io/crates/l/cap.svg?maxAge=2592000)](#License)\n[![Build Status](https://dev.azure.com/alecmocatta/cap/_apis/build/status/tests?branchName=master)](https://dev.azure.com/alecmocatta/cap/_build/latest?branchName=master)\n\n[Docs](https://docs.rs/cap/0.1)\n\nAn allocator that can track and limit memory usage.\n\nThis crate provides a generic allocator that wraps another allocator, tracking memory usage and enabling limits to be set.\n\n## Example\n\nIt can be used by declaring a static and marking it with the `#[global_allocator]` attribute:\n\n```rust\nuse std::alloc;\nuse cap::Cap;\n\n#[global_allocator]\nstatic ALLOCATOR: Cap\u003calloc::System\u003e = Cap::new(alloc::System, usize::max_value());\n\nfn main() {\n    // Set the limit to 30MiB.\n    ALLOCATOR.set_limit(30 * 1024 * 1024).unwrap();\n    // ...\n    println!(\"Currently allocated: {}B\", ALLOCATOR.allocated());\n}\n```\n\n## License\nLicensed under either of\n\n * Apache License, Version 2.0, ([LICENSE-APACHE.txt](LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT.txt](LICENSE-MIT.txt) or http://opensource.org/licenses/MIT)\n\nat your option.\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falecmocatta%2Fcap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falecmocatta%2Fcap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falecmocatta%2Fcap/lists"}