Compare by Contents says files are different when equal
Moderators: Hacker, petermad, Stefan2, white
Compare by Contents says files are different when equal
Hi,
Yesterday I was comparing two AVI's, about 350 MB each. The compare tool stopped with the message that there is not enough memory (ok, we know about this problem), saying the files were DIFFERENT.
However, upon creating MD5sums of said files, they were equal.
How come?
TIA
Roman
Yesterday I was comparing two AVI's, about 350 MB each. The compare tool stopped with the message that there is not enough memory (ok, we know about this problem), saying the files were DIFFERENT.
However, upon creating MD5sums of said files, they were equal.
How come?
TIA
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
hi,
I am sure this is question to Christan, but I believe there is simple possible explanation. "No enough memory" is pretty bad exceptional state from programmer's point of view very hard to handle. This is possible explanation:
You are reading both files let's say by 10k and then comparing. With last 15k of memory you read 10k from the first file, read from the second file fails on out of memory. You are getting error message and since for program one file is 10k longer (file pointer is pointing to different places of files), obviously they are different
As I wrote ...one possible explanation, I am pretty sure Christian will give you different one
ado
I am sure this is question to Christan, but I believe there is simple possible explanation. "No enough memory" is pretty bad exceptional state from programmer's point of view very hard to handle. This is possible explanation:
You are reading both files let's say by 10k and then comparing. With last 15k of memory you read 10k from the first file, read from the second file fails on out of memory. You are getting error message and since for program one file is 10k longer (file pointer is pointing to different places of files), obviously they are different

As I wrote ...one possible explanation, I am pretty sure Christian will give you different one
ado
- ghisler(Author)
- Site Admin
- Posts: 50806
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
TC does the following:
1. It reads the two files in blocks of 32k or so, compares the blocks, reads the next two blocks etc. until both files are compared.
2. If the files are identical, TC shows a message that the files are the same, and doesn't load the visual compare tool
3. If the files are different, it maps them into memory and shows them. If they cannot be mapped into memory, the error will be shown that the files are different and there isn't enough memory.
So what does it mean in your case? Either the files are really different, or there was some kind of read error or RAM error during the initial comparison...
1. It reads the two files in blocks of 32k or so, compares the blocks, reads the next two blocks etc. until both files are compared.
2. If the files are identical, TC shows a message that the files are the same, and doesn't load the visual compare tool
3. If the files are different, it maps them into memory and shows them. If they cannot be mapped into memory, the error will be shown that the files are different and there isn't enough memory.
So what does it mean in your case? Either the files are really different, or there was some kind of read error or RAM error during the initial comparison...
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Similar situation today, however, the files were indeed different, so my gripe is about something else.
Why does TC say there is not enough memory, when comparing two files?
- the files are both 367,032,320 bytes large
- I have 2,2 GB of free memory
- TC's memory usage (Private bytes) never goes above 30 MB
- the comparison stops at 6% saying there is not enough memory.
Why?
TIA
Roman
Why does TC say there is not enough memory, when comparing two files?
- the files are both 367,032,320 bytes large
- I have 2,2 GB of free memory
- TC's memory usage (Private bytes) never goes above 30 MB
- the comparison stops at 6% saying there is not enough memory.
Why?
TIA
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
- ghisler(Author)
- Site Admin
- Posts: 50806
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Yes, the problem is memory fragmentation. TC requests the memory in one block, and if many small blocks have been requested across the memory, there will not be enough free memory in one block for the file. This isn't about real physical memory, but about the virtual address space. TC just maps the entire file into memory, which makes the comparison function much simpler and faster. For technical details, see CreateFileMapping and MapViewOfFile:
http://msdn2.microsoft.com/en-us/library/aa366761(VS.85).aspx
It may help to close and restart just Total Commander. If not, you will need to restart Windows.
http://msdn2.microsoft.com/en-us/library/aa366761(VS.85).aspx
It may help to close and restart just Total Commander. If not, you will need to restart Windows.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
- ghisler(Author)
- Site Admin
- Posts: 50806
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Well, TC first compares the two files via ReadFile loop, which doesn't need much memory. It shows "files identical" if they are the same. If not, then it tries to open them in the compare tool. If this fails too, it says that they are different (which they are because they were really compared).
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
(i'm sorry/pardon/excuse me/i apologise (and one more word it seems to me (i remember a little) i have seen in this forum)). (i do not know yet which is better to use.) i had an file on cd which was written with error message and size of a file in it was correct, and i tried to compare it. and then had seen this topic and wrote here thinking that in my case also tc could not compare though it simple that it is not so.. now i have tried to create checksum and have found out that that file is unreadable.
Hello everybody.
Today I've got a "not enough memory" message from TC while performing a "compare by content" operation on a couple of 750MB files. I find this a bit strange because I used to do this many times in the past without any problem (my PC has 2GB RAM).
I tried also restarting TC, and then restarting Windows, but no effect.
After reading this thread, I also looked around for a way to defragment memory, but I found out that the only way to obtain this is by specific applications/utilities, while I don't like to foddle around and install programs only for this task.
Note that just before that, I made 2 upgrades to my PC: first I installed WinXP SP3, then upgraded from my old 6.54 version of TC to the latest 7.04.
Could my problem be related to this ?
Do you have any suggestion ?
Thanks.
Edited 30min later:
Well, I found my way to carry out the compare using the command "FC /B" in a CMD prompt (quite fast as well) - obviously not easy to map differences, since they are listed vertically and only in the form "address - byte". Lookin forward for a more user-friendly way in TC, though
Today I've got a "not enough memory" message from TC while performing a "compare by content" operation on a couple of 750MB files. I find this a bit strange because I used to do this many times in the past without any problem (my PC has 2GB RAM).
I tried also restarting TC, and then restarting Windows, but no effect.
After reading this thread, I also looked around for a way to defragment memory, but I found out that the only way to obtain this is by specific applications/utilities, while I don't like to foddle around and install programs only for this task.
Note that just before that, I made 2 upgrades to my PC: first I installed WinXP SP3, then upgraded from my old 6.54 version of TC to the latest 7.04.
Could my problem be related to this ?
Do you have any suggestion ?
Thanks.
Edited 30min later:
Well, I found my way to carry out the compare using the command "FC /B" in a CMD prompt (quite fast as well) - obviously not easy to map differences, since they are listed vertically and only in the form "address - byte". Lookin forward for a more user-friendly way in TC, though

read Ghisler's response from "Thu 17.Apr.2008 10:29". It does, but once he tries to open it in compare tools situation is different. That tool is looking back and forth trying to find the same parts. But...actually in this case we are talking about a binary files. You are right for binary comparison that tool can possibly work as the Lister does.
On another hand - do you think it would be worth to implement it when TC now supports external compare tool?
ado
On another hand - do you think it would be worth to implement it when TC now supports external compare tool?
ado