cargo::core::gc

Function auto_gc

Source
pub fn auto_gc(gctx: &GlobalContext)
Expand description

Performs automatic garbage collection.

This is called in various places in Cargo where garbage collection should be performed automatically based on the config settings. The default behavior is to only clean once a day.

This should only be called in code paths for commands that are already doing a lot of work. It should only be called after crates are downloaded so that the last-use data is updated first.

It should be cheap to call this multiple times (subsequent calls are ignored), but try not to abuse that.