Closed someone235 closed 5 months ago
Why only unix?
purge_decommits
setting) for tests as wellversion = "*"
@elichai ?
- should we leave the version free
version = "*"
@elichai ?
Hmm no, in case some of the API(the C API or the allocator name) changes we don't want our code to just break
We don't want any dependencies to be "*"
as that exposes the project to supply-chain attacks whenever Cargo.lock
is reset.
If mimalloc is to be kept, can its initialization please be moved to daemon.rs
or better, a dedicated kaspad/src/memory.rs
module (which is then invoked from main.rs
via a public fn). If this becomes a requirement for rusty kaspa, it should be loadable externally alongside the daemon itself (with pre-configured parameters within this module/loader fn, not in main).
If mimalloc is to be kept, can its initialization please be moved to
daemon.rs
or better, a dedicatedkaspad/src/memory.rs
module (which is then invoked frommain.rs
via a public fn). If this becomes a requirement for rusty kaspa, it should be loadable externally alongside the daemon itself (with pre-configured parameters within this module/loader fn, not in main).
that might not work well if you have C dependencies, if you want the override
feature to work properly then mimalloc has to be passed before any C dependency, meaning it should be the first dependency of the top-most crate
Note that this is only for the C deps, for the Rust deps it shouldn't matter where in the dep graph are you setting the global allocator
Since rusty-kaspa uses a lot of allocations, the RSS remains high even after the memory is free. This should be mitigated by using mimalloc which utilizes the use of MADV_FREE and MADV_DONTNEED (and equivalent techniques on non unix-like systems) which tend to release memory earlier and help in keeping the RSS small.