Compare files by content (binary) - disk cache

Discussion of bugs and problems found in Altap Salamander. In your reports, please be as descriptive as possible, and report one incident per report. Do not post crash reports here, send us the generated bug report by email instead, please.
Marcel_G
Posts: 3
Joined: 07 Jun 2006, 14:25

Compare files by content (binary) - disk cache

Post by Marcel_G »

Hi there

I often use the "compare directories" function to verify burned CDs and to check backups and so on. But sometimes the comparison is done very quickly even on larger files. E.g. if I burn 2 CDs with same content (2 Backups for archive) or if I copy the data via network to another PC, the compare tool does not read from disk or CD again, it reads from the cache.

So I'm not sure if the file really can be read from disk again and its content is correct, right? I assume windows cache management does its work here, but is there a way that ServantSalamander can read data without using the cache for content comparison?

Kind regards,
Marcel
Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5197
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Post by Jan Rysavy »

Unfortunately we have no idea how to invalidate or bypass the Windows read cache, I'm sorry.
Tomas Kopal
ALTAP Staff
ALTAP Staff
Posts: 131
Joined: 07 Dec 2005, 23:01
Location: Prague, Czech Republic
Contact:

Post by Tomas Kopal »

For comparing burnt CD, I eject the disk and insert it again. That invalidates the cache quite well. Don't forget to select the option to compare contents of the files, not just dates!
If you need to do this with non-removable media, you are probably out of luck.
Marcel_G
Posts: 3
Joined: 07 Jun 2006, 14:25

Post by Marcel_G »

I don't know if there is a "unbuffered reader", but most C++ have the possibility to clear the stream buffer. But I'm not sure if this affects windows disk or file cache.

streambuf::sync

Here a link to this function in Microsoft Visual C++ 6.0 on the MSDN:
http://msdn.microsoft.com/library/defau ... a.sync.asp
User avatar
Datalog
Posts: 244
Joined: 10 Dec 2005, 11:21
Location: Prague, Czech Republic
Contact:

Post by Datalog »

Marcel_G wrote:I don't know if there is a "unbuffered reader", but most C++ have the possibility to clear the stream buffer. But I'm not sure if this affects windows disk or file cache.

streambuf::sync

Here a link to this function in Microsoft Visual C++ 6.0 on the MSDN:
http://msdn.microsoft.com/library/defau ... a.sync.asp
Streambuf is higher level function. Really low level API is: FlushFileBuffers or CreateFile with FILE_FLAG_NO_BUFFERING. BUT, both of them affects writing only. For compare it's necessary to invalidate disk read cache - but it is not possible under MS Windows (or not known to me - i.e. it's not in base API).
Marcel_G
Posts: 3
Joined: 07 Jun 2006, 14:25

Post by Marcel_G »

Ok, there seems to be no way, except perhaps to reboot the system befor compare files... :?
Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5197
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Post by Jan Rysavy »

Marcel, try to open the Find window (Alt+F7) on root of your hard disk and search files content for some dummy string. I suppose the read cache becomes invalidated quickly... an empiric approach :)
Post Reply