{"id":21655191,"url":"https://github.com/pseitz/peakmem-alloc","last_synced_at":"2025-04-11T21:14:44.065Z","repository":{"id":152329056,"uuid":"623790745","full_name":"PSeitz/peakmem-alloc","owner":"PSeitz","description":"Measure the peak memory consumption of a given scope in rust","archived":false,"fork":false,"pushed_at":"2024-03-18T10:15:18.000Z","size":10,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-11T21:14:39.532Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","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/PSeitz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2023-04-05T05:07:27.000Z","updated_at":"2024-12-23T12:42:50.000Z","dependencies_parsed_at":"2024-03-18T11:29:58.532Z","dependency_job_id":null,"html_url":"https://github.com/PSeitz/peakmem-alloc","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/PSeitz%2Fpeakmem-alloc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PSeitz%2Fpeakmem-alloc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PSeitz%2Fpeakmem-alloc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PSeitz%2Fpeakmem-alloc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PSeitz","download_url":"https://codeload.github.com/PSeitz/peakmem-alloc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248480427,"owners_count":21110937,"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-25T08:30:35.147Z","updated_at":"2025-04-11T21:14:44.032Z","avatar_url":"https://github.com/PSeitz.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# peakmem_alloc\n\nAn instrumenting middleware for global allocators in Rust, useful to find the peak memory consumed by a function.\n\n## Example\n\n```rust\nuse peakmem_alloc::*;\nuse std::alloc::System;\n\n#[global_allocator]\nstatic GLOBAL: \u0026PeakMemAlloc\u003cSystem\u003e = \u0026INSTRUMENTED_SYSTEM;\n\n#[test]\nfn example_using_region() {\n    GLOBAL.reset_peak_memory(); // Note that other threads may impact the peak memory computation.\n    let _x: Vec\u003cu8\u003e = Vec::with_capacity(1_024);\n    println!(\n        \"Peak Memory used by function : {:#?}\", \n        GLOBAL.get_peak_memory()\n    );\n}\n\n``` \n\n## Custom allocators\n\nYou can wrap your existing allocator as follows:\n\n```rust\nuse jemallocator::Jemalloc;\nuse peakmem_alloc::*;\n\n#[global_allocator]\nstatic GLOBAL: PeakMemAlloc\u003cJemalloc\u003e = PeakMemAlloc::new(Jemalloc);\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpseitz%2Fpeakmem-alloc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpseitz%2Fpeakmem-alloc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpseitz%2Fpeakmem-alloc/lists"}