简体   繁体   English

为什么rust中的target/debug/deps目录那么大

[英]Why is the target/debug/deps directory so big in rust

Today when I check the rust(1.54) folder, I found the target/debug/deps folder using 9.6GB.今天查看rust(1.54)文件夹,发现target/debug/deps文件夹占用9.6GB。

➜  debug git:(main) ✗ du -sh deps
9.6G    deps

why the rust target/debug/deps using so much space?为什么 rust target/debug/deps使用了这么多空间? is it possible to limit the space using?是否可以限制使用空间? what should I do to optimize it.我应该怎么做才能优化它。 There is many files look like this:有很多文件看起来像这样:

reddwarf_admin-2f9d6d6d595f65af.2m9e5nlrurh2eiv4.rcgu.o

Cargo stores there all the results of the compilation (which is already quite big, since Rust's binaries are quite big already), but also much more information (all the incremental build information, as pointed out by @BailpointBen). Cargo 在那里存储了所有编译结果(这已经相当大了,因为 Rust 的二进制文件已经相当大了),但也存储了更多信息(所有增量构建信息,正如@BailpointBen 所指出的)。 Their purpose is to not have to recompile everything when making small changes.他们的目的是在进行小改动时不必重新编译所有内容。 You can think of them as cache: you can freely delete it, but then the compiler is going to have to make these computations aggain.您可以将它们视为缓存:您可以随意删除它,但随后编译器将不得不重新进行这些计算。 My advice would be to leave them be while you work on a project, and when you stop clean them, so you got ~10G space usage at most due to Rust cache, instead of piling up in each project you have.我的建议是在您处理项目时保留它们,当您停止clean它们时,由于 Rust 缓存,您最多使用 ~10G 空间,而不是堆积在您拥有的每个项目中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM