RAMdisk

Can you create a RAMdisk in VB2005 (or VB6) code
I write a file to the hard disk, and then read it back for viewing and printing.

Sometimes I need a faster turn-around time. Loading or Reading from RAM would avoid introducing delays to wait for the disk file to be ready.

The Help section mentions getting Drive info, but not much on creating a RAMdisk



Answer this question

RAMdisk

  • Scott Cameron

    You can use the MemoryStream class to save and read (file)streams from memory. No writing to disk.



  • Dejvino

    Thanks for the idea of using the MemoryStream. That allows the info to stay in main memory. But for some applications I'm using an ActiveX control (such as Acrobat PDF reader) and it wants to do a "LoadFile" and expects a format of Directory & filename. From the examples I saw for MemoryStream, that does not seem possible. I need to get an alternate format for the "Load" part, or a RAMdisk which also expects a standard filename.

    Is RAMdisk being discouraged


  • Guemundur

    You can download a ramdisk driver and compare performance between filebased and see if it really will be a big difference.

    You could also leave this part up to the user. Your application will allow to set another temporary file location. A user with a ram drive can then use that as temporary file location.

    If the file is not too large it might still be in the filesystem cache and reading it will not actually read from the harddrive.



  • RAMdisk