High CPU usage when deleting files (Vista/W7)
Moderators: Hacker, petermad, Stefan2, white
High CPU usage when deleting files (Vista/W7)
When deleting files in Vista or Window 7 CPU usage goes through the roof and deleting is very slow.
This is not caused by antivirus or any similar program, I tested it on freshly installed OS, where TC was the only program installed. Indexing was turned off and the drive that I deleted from is not monitored by system restore. Also, thumbnails and logging in TC are turned off.
It does not happen if I set TC to use Explorers delete method.
When looking at totalcmd.exe threads in Process Explorer while deleting, all the CPU cycles are consumed by several threads of ntdll.dll!RtlGetCurrentPeb+0x155 with some insane numbers of cycles delta and TOTALCMD.exe+0x35f0. All other running processes have CPU usage under 1%.
Ah, and another weird thing, setting TCs process to lower priority actually speeds deleting up.
This is not caused by antivirus or any similar program, I tested it on freshly installed OS, where TC was the only program installed. Indexing was turned off and the drive that I deleted from is not monitored by system restore. Also, thumbnails and logging in TC are turned off.
It does not happen if I set TC to use Explorers delete method.
When looking at totalcmd.exe threads in Process Explorer while deleting, all the CPU cycles are consumed by several threads of ntdll.dll!RtlGetCurrentPeb+0x155 with some insane numbers of cycles delta and TOTALCMD.exe+0x35f0. All other running processes have CPU usage under 1%.
Ah, and another weird thing, setting TCs process to lower priority actually speeds deleting up.
- ghisler(Author)
- Site Admin
- Posts: 50421
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
This is a duplicate:
http://ghisler.ch/board/viewtopic.php?t=22741
http://ghisler.ch/board/viewtopic.php?t=22741
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
- ghisler(Author)
- Site Admin
- Posts: 50421
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Hmm, after a quick look at MSDN it doesn't seem to support deleting to the recycle bin - at least there doesn't seem to be an option to delete to recycle bin or not:
http://msdn.microsoft.com/en-us/library/bb775765(VS.85).aspx
Otherwise it looks very promising, allowing to get confirmation about the deletion of each item...
http://msdn.microsoft.com/en-us/library/bb775765(VS.85).aspx
Otherwise it looks very promising, allowing to get confirmation about the deletion of each item...
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
It should delete to recycle bin by default as said in http://msdn.microsoft.com/en-us/library/bb775799(VS.85).aspx
If this method is not called, the default value used by the operation is FOF_ALLOWUNDO | FOF_NOCONFIRMMKDIR
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
- ghisler(Author)
- Site Admin
- Posts: 50421
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Thanks, that looks indeed very promising. I will make some tests with it.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
- ghisler(Author)
- Site Admin
- Posts: 50421
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
I have just tested these interfaces today, and they are almost perfect when sending them the list of selected files with DeleteItem() and then calling PerformOperations(). Unfortunately they do have some problems too:
1. The do not warn about read only or hidden/system files!
That seems to be the case in XP Explorer too!
2. There seems to be no way to find out before calling these functions whether the drive supports the recycle bin or not
3. It's not possible to skip files in PreDeleteItem(), only accept the deleting or abort the entire process. Therefore I cannot let the user choose whether he wants to skip read only files or not...
1. The do not warn about read only or hidden/system files!

That seems to be the case in XP Explorer too!

2. There seems to be no way to find out before calling these functions whether the drive supports the recycle bin or not
3. It's not possible to skip files in PreDeleteItem(), only accept the deleting or abort the entire process. Therefore I cannot let the user choose whether he wants to skip read only files or not...
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
- ghisler(Author)
- Site Admin
- Posts: 50421
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
I'm using IFileOperation now by default in beta 6, but each file individually. This still causes high CPU, but it's much faster then SHFileOperation.
To delete all selected files/folders together, you need to add
VistaDelete=1
to wincmd.ini under [Configuration]. Note that the progress bar sometimes behaves strangely, but that's because TC is getting strange values for number of files deleted/total files from the file progress interface.
To delete all selected files/folders together, you need to add
VistaDelete=1
to wincmd.ini under [Configuration]. Note that the progress bar sometimes behaves strangely, but that's because TC is getting strange values for number of files deleted/total files from the file progress interface.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
-
- Junior Member
- Posts: 92
- Joined: 2004-06-27, 15:24 UTC
Is it possible to supress the Windows 'Delete Folder' warning when using VistaDelete=1?
Here is a screenshot: http://www.rugby-forum.ru/temp/delete.jpg (Win7 RC1, TC 7.5b6).
Here is a screenshot: http://www.rugby-forum.ru/temp/delete.jpg (Win7 RC1, TC 7.5b6).
CU
VK
VK
- ghisler(Author)
- Site Admin
- Posts: 50421
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
I was asked that also in the private beta forum, but unfortunately there seems to be no way to do that. It's possible to turn off all dialogs, but not just the initial dialog before the deletion starts. 

Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
- ghisler(Author)
- Site Admin
- Posts: 50421
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Unfortunately it isn't - there is an option "reply yes to all dialogs", but not "notify me about all problems". 
Maybe Microsoft will add this to Windows 8...

Maybe Microsoft will add this to Windows 8...
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
- ghisler(Author)
- Site Admin
- Posts: 50421
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Since you can now use VistaDelete=1, I'm moving this to "fixed bugs".
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com