-8.51 after update - folder sync RAM and CPU 100% (solved)

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: white, Hacker, petermad, Stefan2

kargol
Junior Member
Junior Member
Posts: 24
Joined: 2013-02-25, 09:50 UTC
Location: Dresden

-8.51 after update - folder sync RAM and CPU 100% (solved)

Post by *kargol »

during folder sync (asynchronous) TC is slowing down my computer completely. It needs 100% of both Processors (totalcmd64.exe) and my complete RAM (4GB) during first phase (delete of nonexistend files in target directory). (Options: use Explorer-method)

The following copy action is without problems (50% of CPU)

system WIN7 x64
Last edited by kargol on 2015-06-11, 11:02 UTC, edited 1 time in total.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Perhaps it was Explorer slowdown because of putting every file to recycle bin separately?
kargol
Junior Member
Junior Member
Posts: 24
Joined: 2013-02-25, 09:50 UTC
Location: Dresden

Post by *kargol »

MVV wrote:Perhaps it was Explorer slowdown because of putting every file to recycle bin separately?
Looks like as the problem-cause. After System restart it works well. Thank you for comment.

kargol
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Please try to remember how to reproduce if problem will appear again.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48166
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

This isn't a bug in TC, it's a bug in Windows: It's not possible to delete files from multiple directories to recycle bin with a single function call. TC has to call the function for each directory separately. Unfortunately Windows creates a new thread for each directory, so this can overload the system when deleting files from many directories at the same time.
Author of Total Commander
https://www.ghisler.com
User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Post by *MarcinW »

Maybe TC could serialize deleting - for example something like this:

- set directory change notification,
- start deleting the first directory,
- wait for the notification and check if the directory has been successfully deleted,
- repeat the above for each next directory.

Optionally, TC could delete simultaneously as many directories as available CPUs cores - in this way, deleting shouldn't be slower than the current method, in fact it should be faster by avoiding excessive thread creation.

Regards
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48166
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

That's an interesting idea, although it could cause a big slowdown over networks: When I delete a folder on Windows 7, another Windows 7 PC seems to see the change (via FindFirstFile) only about 10 seconds later...
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

As I know, SHFileOperation supports multiple file paths, they must be divided with nulls, and two nulls must be at the end... But I don't know if it may delete from different directories at once...
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48166
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

2MVV
I tried this, but when I put files from different directories in the list, then the ENTIRE directories were deleted - not just the (few) files I put in the list...
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Checked it, following code deletes only two specified files, even when there are other files and subfolders:

Code: Select all

		SHFILEOPSTRUCT fos={0};
		fos.wFunc=FO_DELETE;
		fos.fFlags=FOF_ALLOWUNDO; // may be commented to delete w/o recycle bin
		fos.pFrom=L"D:\\Temp\\shoperation\\0\\test.cpp" L"\0"
			L"D:\\Temp\\shoperation\\1\\UpgradeLog.XML" L"\0";
		int r=SHFileOperation(&fos);
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48166
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Maybe they fixed it in the meantime in some service pack or windows update. Since I don't know when they fixed it and how well, I don't want to take the risk.
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Which OS have you tested? Is it XP problem or Vista/7?
User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Post by *MarcinW »

ghisler(Author) wrote:I tried this, but when I put files from different directories in the list, then the ENTIRE directories were deleted - not just the (few) files I put in the list...
Maybe there was just a mistake when trying to delete multiple folders with SHFileOperation...?

There are two important requirements:
1) Names should be fully qualified paths to prevent unexpected results.
2) Each file name is terminated by a single NULL character. The last file name is terminated with a double NULL character ("\0\0") to indicate the end of the buffer.

Can you reproduce the problem again?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48166
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Strange, my reply has disappeared. I'm not using SHFileOperation, because it doesn't allow to show my own progress dialog. I'm using the following newer function:

Code: Select all

CoCreateInstance(CLSID_FILEOPERATION,nil,CLSCTX_ALL,IID_IFILEOPERATION,pfo);
pfo.SetOperationFlags(FOF_ALLOWUNDO);
pfo.SetOwnerWindow(FileDlgHandle);
pfo.Advise(opsink,@cookie);
pfo.SetProgressDialog(opprogr);
hr:=SHCreateItemFromParsingName(fullname,nil,IID_ISHELLITEM,psiFrom);
if SUCCEEDED(hr) then
  hr:=pfo.DeleteItem(psiFrom,nil);
if SUCCEEDED(hr) then begin
  hr:=pfo.PerformOperations;
Author of Total Commander
https://www.ghisler.com
User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Post by *MarcinW »

I have no experience with this, but - as I understand - this code returns immediately, before files/folders are deleted? So, as a consequence, TC calls this code in a loop and this causes massive thread creation?
Post Reply