Author Topic: TIP: Use a paging file no matter how much RAM you have to avoid crashes.  (Read 28483 times)

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Windows is kind of funny.  If it doesn't have a paging/swap file (which it does by default), then it stops handing out RAM to some applications when their usage hits a certain point.  Then you start running into crashes in high-memory-use programs like 3D rendering software, games, and so forth.  Looks like instability in the programs themselves, but it's not.

A lot of folks that have 8-16GB of RAM think they don't need a paging file, and so they turn it off.  This is when the issues come into play, but it's not all the time and only with certain programs that use a really large amount of RAM, so it definitely doesn't give immediate feedback that this isn't a good idea to do.  Windows definitely needs a paging file, or it doesn't know what to do with itself!  Rather than allocating more user space RAM or putting some older data to disk, it just... causes programs to crash when they run out of userspace RAM.

By which I mean, you could have 16 GB of RAM, and 13 GB of RAM free, and still get an "out of memory" crash in various programs -- including any Unity 3D engine game, which means all of ours -- simply because your paging file was turned off.  Yikes!

My suggestion for a paging/swap file is to set it to a static 1.5 or 2 GB or so. Then it's not constantly resizing on your disk, keeping your performance up; but then also windows has a safety outlet into which to dump older memory objects if it runs out of local room in which to do so.  The folks who turn off their paging file seem to do so because of wanting to maximize performance, but a statically-sized swap file (that is quite large) is actually the best way to do that while maintaining stability in my opinion.

If you have a lot of RAM and your swap file off, I sincerely hope this reaches you before you get a crash, rather than after!
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline mrhanman

  • Hero Member Mark II
  • *****
  • Posts: 764
Another option is using RAM drive software, and putting your swap file on it.  Best of both worlds!

Of course, this might cause its own problems, but some people swear by it - especially those with SSDs.
« Last Edit: April 24, 2012, 03:06:06 pm by mrhanman »

Offline Mánagarmr

  • Core Member Mark V
  • *****
  • Posts: 4,272
  • if (isInRange(target)) { kill(target); }
Huh, that was actually not a bad idea. I accidently got twice as much RAM as I intended when I ordered my new computer (16 instead of 8) so I could probably turn half of that into a RAM-drive and run the swap file out of. !!SCIENCE!! is required.
Click here to get started with Mantis for Suggestions and Bug Reports.

Thank you for contributing to making the game better!

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Huh, that was actually not a bad idea. I accidently got twice as much RAM as I intended when I ordered my new computer (16 instead of 8) so I could probably turn half of that into a RAM-drive and run the swap file out of. !!SCIENCE!! is required.
!!SCIENCE!! will, in any event, ensue.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!