-
Notifications
You must be signed in to change notification settings - Fork 39
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
Warn on very large assets #20
Comments
Even 100MB is way too big. Today I had a reported issue where rustc used over 8GB of memory because a single 12MB file was misplaced into the directory. |
I'm quite surprised. If you look at the implementation, files are embedded by creating a normal |
I do admit it that it is a fairy simple implementation (and I would not have expected the immensely popular On linux: # Make a 15 MB file
dd if=/dev/zero of=src/item bs=1M count=15
# Limit this shell process and all children to approx 8GB for ease of testing
ulimit -v 8000000
cargo build
# eventually dies with 'memory allocation of 171872600 bytes failed' I notice that What about having the impl ToTokens for File {
fn to_tokens(&self, tokens: &mut TokenStream) {
let path = self.path.display().to_string();
let tok = quote!{
File {
path: #path,
// FIXME: might need adjustment to account for CARGO_MANIFEST_DIR
contents: include_bytes!(#path),
}
};
tok.to_tokens(tokens);
}
} I'm going to try playing around with this. |
Okay, so I tried my suggestion above, and:
|
Sorry for hijacking this issue, by the way. I've created #33 as a separate actionable item or for continuing this discussion. |
I accidentally tried to include about 400MB of stuff the other day and
rustc
ended up using stupidly huge amounts of RAM trying to compile it all. It's probably a good idea to emit a warning if the embedded assets will be larger than about 100MB or so...The text was updated successfully, but these errors were encountered: