ls: properly release parent nodes in DFS#11465
Conversation
|
Would you add test? |
I'm not even sure of how to build a minimum reproducible example lol, but I'll try. I found this by dumb luck. |
Merging this PR will improve performance by ×15
Performance Changes
Comparing Footnotes
|
|
It appears this fixes this fully fixes the insane memory consumption introduced by the DFS PR lol. |
I've discovered I can't since this relies on hard links of directories, which are not a thing on most filesystems. |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
Windows has many hardlinks on WinSxS, or you can make hardlink at tests. |
|
Pushed a quick fix of a bug I found while writing the test lol |
|
Add |
|
GNU testsuite comparison: |
|
|
@oech3 I don't think there's a clear path to being able to reliably test this in an integration test because of how hard it is to replicate an environment like debug_assert!(state.listed_ancestors.is_empty());
// or similarly
#[cfg(test)]
impl Drop for ListState {
fn drop(&mut self) {
assert!(self.listed_ancestors.is_empty());
}
}Or whichever of the two-factorial solutions you find most suitable, if any. |
|
debug_assert! is OK. We can improve test later if someoun found the way... |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
@sylvestre should we add |
|
Probably thanks |
As seen in uutils#11465, among others.
As seen in #11465, among others.
|
@sylvestre can we rerun this? |
|
@Alonely0, could we make the dfs common with what we do in the tsort util? |
Sure thing, I'll look into it after my midterms. |
I can just re-run it by rebasing :) |
Fixes a regression introduced in uutils#11386 (sorry) where DFS nodes did not properly free the recorded inodes of the parent directories, causing critical errors in some instances of recursive symlinks.
Depending on the sorting it would not, so it could recurse back through `..`.
It is now PathData::is_dot_dir, which is more descriptive.
|
GNU testsuite comparison: |
|
@sylvestre sorry for the ping, is there something else you would like to see here? :) Lmk if there is anything I can do (also, the CI failure is unrelated). |
As seen in uutils#11465, among others.
Fixes a regression introduced in #11386 (sorry) where DFS nodes did not properly free the recorded inodes of the parent directories. This caused critical errors in some instances of recursive hard links, and made memory usage increase with a combinatorical explosion.