Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scratch disks in Python?

I understood that in certain Windows XP programs, like Photoshop, there is something called "scratch disks". What I understood that this means, and please correct me if I'm wrong, is that Photoshop manages its own virtual memory on the hard-drive, instead of letting Windows manage it. I understood that the reason for this is some limitation by Windows XP on how much total memory a process can take, regardless of HD space. I think it's around 3 GB. Did I get it right so far?

I am making an application in Python for running simulations. It will take a lot of memory, and will run on Windows XP. Is it possible for it to use scratch disks? How?

like image 646
Ram Rachum Avatar asked Dec 28 '25 12:12

Ram Rachum


2 Answers

Until you ACTUALLY run out of memory, thinking about this is a waste of time.

When you finally do run out of memory, you'll need to use a temporary file to store objects that your process needs, but can't fit into memory.

Use pickle or shelve (see Data Persistence) your objects in a file. If that file happens to be on a disk named "scratch", well that's nice.

Sometimes you want your temporary files to be on a separate disk from your other working files for performance reasons. In some environments (SAN, NAS, storage arrays) your disks are virtual and looking for a "scratch" disk doesn't have any performance benefit. In other environments (i.e., you own all the hardware) you can put temporary files on some other drive, making that drive a "scratch" disk.

like image 76
S.Lott Avatar answered Dec 31 '25 01:12

S.Lott


I understood that the reason for this is some limitation by Windows XP on how much total memory a process can take, regardless of HD space. I think it's around 3 GB.

Just an FYI, this is more a limitation of a 32-bit OS rather than being a Windows XP problem. You'll have the same problem in 32-bit Vista, linux, bsd... you get the idea. If you go the 64-bit route, you don't have these problems.

For example, Windows XP x64 allows up to 8 terabytes of memory per process.

like image 29
Jason Baker Avatar answered Dec 31 '25 02:12

Jason Baker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!