namazso/OpenHashTab

Please, do not automatically scan a folder if it contains too much files

Opened this issue · 2 comments

In normal situations, when clicking on the "Hashes" tab of a folder properties dialog, it automatically starts scanning all the files inside it. This will not cause too many lags when the folder contains <1,000 files. However, if I have a folder with 100,000+ files with a total size of hundreds of GB, it freezes when clicking on "Hashes" for seconds, after that it starts scanning all the files inside it! Taking 100% activity time of my SSD and continuously increasing the RAM usage, which eventually freezes the whole system. The "Cancel" button (which cancels the hash calculation) no longer responds, I have to manually kill "explorer.exe" to stop the hashing process to get my system back to normal.

I strongly recommend that automatic scan should only be started if the file count is <1000, preventing system freezes when user accidentally clicks on "Hashes" of a very large folder.

The main problem is that directory iteration is synchronous. And that's because Win32 only has synchronous APIs. However there's the undocumented NT API which does support asynchronous directory listing.

The eventual goal is to rewrite OpenHashTab to utilize that.

Shouln't it be sufficient to use the default API in a seperate thread? Using undocumented APIs leads to suddenly disfunctional software on updates ...