3 ms·
Btw, on Windows if you want to purge a specific file out of the cache, then all you need to do is to reopen the file with NO_BUFFERING and/or OVERLAPPED, and cl
by malkia 14y ago
Btw, on Windows if you want to purge a specific file out of the cache, then all you need to do is to reopen the file with NO_BUFFERING and/or OVERLAPPED, and close it.
This could be verified with SysInternals RamMap.
- ComputerGuru 14y agoI don't know that this accomplishes the same thing. It's not a question of getting this file/data out of the cache so much as it is about not replacing existing cache contents with this one. Removing a file from the cache after the fact doesn't address the problem that it kicked some other data out of the cache to take its place in the first place.
- malkia 14y agoI agree. But let's say that you have a list of lots of files that are to be copied from the server to your machine. If one "frees" each file after copying, then at least the biggest harm done would be the size of the biggest file. Now the copying itself could've been done by using NO_BUFFERING, but if it's done by program you don't have access (or it's not straightforward copying, but say rsync (DeltaCopy) or something like that). It's not the same really as you are saying, but related somehow. We had to do this at our studio, there was a process copying lots of fresh sound banks for the game, and it was trashing the cache which is normally filled with the game assets that are used during level building. Originally we though of directly copying files using NO_BUFFERING, but because the app was written in #C, it was a bit harder (and we didn't want to introduce insecurities). So the programmer in charge, just added one more Open/Close after the file was copied which was done with NO_BUFFERING - this purged the file from the cache. Obviously not going to work, if instead of many sound banks, it was one huge taking all space. But since that was not the case, we took the opportunity.
- ComputerGuru 14y agoThanks for explaining the rationale behind such a use case. Sound reasoning indeed.