[package] name = "commonware-allocator" edition.workspace = true publish = true version.workspace = true # The vendored mimalloc sources in `mimalloc/` are MIT licensed. license = "(MIT OR Apache-2.0) AND MIT" description = "Allocate and manage memory." readme = "README.md" homepage.workspace = true repository = "https://github.com/commonwarexyz/monorepo/tree/main/allocator" documentation = "https://docs.rs/commonware-allocator" # Cargo rejects a dependency graph in which another package, such as # `libmimalloc-sys`, also declares this key. Two such packages would each # link their own copy of mimalloc into the same binary. links = "mimalloc" build = "build.rs" [lints] workspace = true [dependencies] commonware-macros = { workspace = true, features = ["std"] } libc = { workspace = true, optional = true } [build-dependencies] cc.workspace = true [features] default = [ "mimalloc" ] mimalloc = [ "dep:libc" ] # Raise the largest allocation served from a thread-local page (512 KiB by # default). This scales every mimalloc page, and with it the memory each size # class holds per thread. Only binaries should enable one, and the largest # enabled feature wins. See the page geometry section of the `mimalloc` # module docs. large-objects-1mb = [] large-objects-2mb = [] large-objects-4mb = [] # Build mimalloc for a shared library that is loaded with `dlopen`, with the # local-dynamic thread-local storage model. See the linking section of the # `mimalloc` module docs. local-dynamic-tls = []