-
Notifications
You must be signed in to change notification settings - Fork 13.3k
staticlib creates huge files #18569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This looks very similar to #18541 , although worse because the linker version script workaround does not work in this case. |
I don't think this is the same issue as #18541. In this case, compiling this on OS X x86_64 with But compiling with It's worth noting that in the equivalent bare-bones executable, none of that is included, and the final binary is 8K (on OS X). |
On the other hand, compiling a small stdlib program like fn main() {std::io::stdio::stdout_raw().write_all(b"Hi\n");} even with By instruction count, at least two thirds of that rust executable is jemalloc. |
It seems like the allocations performed in the lang_start drag jemalloc in. There should be a way to do this without allocation right? It would shave off 200K+ from the minimal executable size. |
In fact, I think it's just one allocation: let thread: Thread = NewThread::new(Some("<main>".to_string())); NewThread should be rewritten to take |
I just opened issue #22525. It might be related. |
@rprichard My minimal stdlib program, compiled above with I also checked the instruction usage, and literally 70.6% of the executable is jemalloc. |
On Windows, at least half of the executable size appears to be due to jemalloc's debug into. |
This creates a 1.3MB file unsuitable for distribution. The real size should be closer to 0 bytes because there are 0 public symbols.
The text was updated successfully, but these errors were encountered: