namazso / OpenHashTab

📝 File hashing and checking shell extension
GNU General Public License v3.0
3.29k stars 127 forks source link

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

Open haojiezhe12345 opened 6 months ago

haojiezhe12345 commented 6 months ago

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.

namazso commented 6 months ago

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.

JustMyGithub commented 5 months ago

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

ThioJoe commented 2 months ago

I think this is a duplicate of https://github.com/namazso/OpenHashTab/issues/159

Surprised even a workaround like disabling folder hashing hasn't been implemented yet.