diff options
author | andy.boot <bootandy@gmail.com> | 2022-08-12 14:36:26 +0100 |
---|---|---|
committer | andy.boot <bootandy@gmail.com> | 2022-08-15 14:05:24 +0100 |
commit | b9386cd39e1f4dfb4f9d1e45dd26b2b25750087c (patch) | |
tree | a5ff49aadfaaef827ae589c434c7ffc90091fd85 | |
parent | 17112b09ccbf1ca08e1328cf70ac2507806bdaee (diff) |
Fix: Increase Stack size
Low stack size could result in a stack overflow exception if traversing
very highly nested directories.
This makes core-dumps less likely but will not completely remove the
risk
example for creating directories:
mkdir -p $(for i in {1..5000}; do echo -n "qwe/"; done)
original issue:
https://github.com/bootandy/dust/issues/197
-rw-r--r-- | src/main.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index 5be505c..f0f179f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -295,6 +295,11 @@ fn main() { by_filecount, ignore_hidden, }; + // Larger stack size to handle cases with lots of nested directories + rayon::ThreadPoolBuilder::new() + .stack_size(usize::pow(1024, 3)) + .build_global() + .unwrap(); let (top_level_nodes, has_errors) = walk_it(simplified_dirs, walk_data); |