Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

jtech

Cache files

This topic is 6135 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Why do some programs explicitly store large amounts of data in temporary cache files (e.g. c:/windows/temp) ? Isn''t this what virtual memory is used for? Doesn''t Windows do all of this for you? Why are these programs, like Photoshop, doing it themselves? I assume they are, as I have never seen any of my programs dump data into the temp folder without my knowledge.

Share this post


Link to post
Share on other sites
Advertisement
Sometimes its nice to have a backup copy of your work on disk in case of a crash. I know most word processing programs save a temp file somwhere for this reason.

Other reasons may be the programmers have developed a custom paging scheme for their app that works better for their needs than the default OS one.

Share this post


Link to post
Share on other sites
I was just wondering if doing my own disk caching would improve performance
and minimize hard drive thrashing. If say, I wanted to dynamically allocate
a large chunk of memory with the new operator. Would I really want to write
it to disk, or just keep it in memory.

Share this post


Link to post
Share on other sites
Doing your own caching can, under certain circumstances, dramatically increase performance. Especially under Win9x, where memory management is unbelievably bad. Eg. if you want to swap out a continous region of memory, and swap it in later, it is faster to do a single fwrite/fread on the buffer, than letting Windows handle it through the general purpose virtual memory swapper. On Win2k, it''s somewhat different, since memory management is alot better. Although, when done right, it can still improve performance. Be careful though, or Windows will actually cache your swapfile in system memory...

Share this post


Link to post
Share on other sites
quote:

Be careful though, or Windows will actually cache your swapfile in system memory...



That would defeat everything if Windows knew about my cache file. Does
Windows leave freads/fwrites alone? What about CreateFileMapping?
I wonder if there are some tricks with CreateFileMapping that tells the
Windows swap file to leave it alone.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!