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 degrade performance by 5.35%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Memory | ls_recursive_long_all_deep_tree[(100, 4)] |
126.3 KB | 107.8 KB | +17.12% |
| ⚡ | Memory | ls_recursive_mixed_tree |
133 KB | 122.5 KB | +8.55% |
| ⚡ | Memory | ls_recursive_balanced_tree[(6, 4, 15)] |
1,817.8 KB | 117.3 KB | ×15 |
| ⚡ | Memory | ls_recursive_deep_tree[(200, 2)] |
143.3 KB | 106.9 KB | +33.98% |
| ⚡ | Memory | ls_recursive_long_all_balanced_tree[(6, 4, 15)] |
1,988.5 KB | 288 KB | ×6.9 |
| ⚡ | Memory | ls_recursive_long_all_mixed_tree |
133.6 KB | 123.1 KB | +8.51% |
| ❌ | Simulation | ls_recursive_wide_tree[(10000, 1000)] |
35.3 ms | 36.5 ms | -3.27% |
| ❌ | Simulation | ls_recursive_balanced_tree[(6, 4, 15)] |
51.8 ms | 54.8 ms | -5.35% |
Comparing Alonely0:fix-ls-rec (a2cacf1) with main (e0f0318)
Footnotes
-
46 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
|
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: |
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.
|
GNU testsuite comparison: |
|
Windows has many hardlinks on WinSxS, or you can make hardlink at tests. |
Depending on the sorting it would not, so it could recurse back through `..`.
|
Pushed a quick fix of a bug I found while writing the test lol |
|
Add |
|
GNU testsuite comparison: |
|
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.