0

I get a very large size of my compiled Rust application, when I compile it in release mode the target directory grows to a size of 0.5 GB. My source code is 32 KB so I think it is my dependencies that create the large size but when I check the size of the packages on cargo.io it doesn't add up close to 500 MB. Can I somehow find the cause of the size? Here is my cargo.toml:

[package]
name = "communcation_service"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
reqwest = { version = "0.11", features = ["json"] }
tokio = { version = "1", features = ["full"] }
serde_json = "1.0"
serde = "1.0"
lapin = "2.1.1" # Kinda big
futures-lite = "1.12.0"
tracing = "0.1.37"
tracing-subscriber = "0.3.16" # Kinda big
dotenv = "0.15.0"
base64 = "0.13.1"
async-trait = "0.1.58"
web-push = "0.9.3"
sentry = "0.23.0"
lettre = { version = "0.10.0-beta.2", default-features = false, features = ["smtp-transport", "tokio1-rustls-tls", "hostname", "r2d2", "builder"] }
cafce25
  • 15,907
  • 4
  • 25
  • 31
Hugo Persson
  • 33
  • 1
  • 6
  • 1
    There is a lot of stuff in the target directory. Look at the executable, not the other files. – tkausl Dec 18 '22 at 21:24
  • You can use [`cargo-bloat`](https://crates.io/crates/cargo-bloat) to find out which crates take up space. – Jmb Dec 19 '22 at 07:53

0 Answers0