The other day, while running incremental backups on my laptop, I was struck by a familiar yet unwelcome sight: a steady stream of changed files. Despite primarily working on just a few personal Rust projects in my free time, the sheer volume of modifications was significant. It brought back vivid memories of my past Node.js projects and the seemingly ever-expanding universe of node_modules folders.
Digging deeper, the culprit quickly revealed itself: the seemingly innocuous target directory. As the central hub for all build artifacts (compiled binaries, libraries, and intermediate build files) generated by Cargo, Rust’s powerful build system, this folder had quietly ballooned in size. My inner cheapskate cried out! Faster backups, more efficient disk usage – surely Rust, with its reputation for efficiency, wasn’t inherently destined to sprawl across my precious storage?
I changed the cargo home/cache directory so it’s easier to clean up. The disk space pollution of Rust is insane.
I did a small project project that resulted in an 8 MB executable. And had dozens of gigabytes to clean up.
Even more confusing was how closing VS Code lead to 11 GBs being freed. I initially had three or four projects open for reference in APIs and API usage. But my primary partition ran full quickly. In the end I used Rover and minimized IDE usage to two instances. And after my work, removed target and cargo build data again so I actually have space to work with on my primary partition.
I used to compile zed since there was no Linux binary back then, then I discovered the disk use was 90 GB :|
@Tenkard @Kissaki only ? That’s a bargain 😬