- computer memory (aka "primary storage") is used by the OS to load programs into and store data while they are being processed. Must be fast to access (to match the CPU speed) and is thus expensive.
- hard-drive (aka "secondary storage", also includes tape drives, optical drives, etc.) are used for non-volatile storage. These days is often quite cheap (per bit), but in general can be much slower to access than volatile memory.
Can I fix 'Out of Memory' error by attaching an external drive?
15 views (last 30 days)
Show older comments
I have an external hard drive with lots of storage, I am not sure how much space my computer has, but probably not a ton so I am hoping this will help. I moved the matlab file to the external drive and tried to run it there and had the same issue.
I am running a kinda big computation, I am making a 9000*9000 matrix, but as soon as I make it right, I use sparse, but overall still a big computation going on.
If the drive can help, how can I make my computer utilize that space?
Thank you!
1 Comment
Stephen23
on 13 Apr 2021
Edited: Stephen23
on 13 Apr 2021
"I am not sure how much space my computer has, but probably not a ton so I am hoping this will help."
In general no: a hard-drive is not primary computer memory. Although it is possible to configure the OS to use the hard-drive as part of virtual memory, this generally slows down data processing. There is no real subsitute for fast computer memory.
"space" is an ambiguous term, it is not clear if you are referring to computer memory or data storage.
"I moved the matlab file to the external drive and tried to run it there and had the same issue."
Of course, because changing where files are saved does not change the computer memory (which is what MATLAB uses for the data when it is imported).
Accepted Answer
David Fletcher
on 12 Apr 2021
Unfortunately a hard disk is a poor alternative to physical RAM. Whilst it is possible to get Windows to use the hard disk as virtual memory, it is a painfully slow alternative. If you want to try it, have a look here, or google setting up virtual memory.
2 Comments
David Fletcher
on 12 Apr 2021
Edited: David Fletcher
on 12 Apr 2021
Given the size, I'm guessing it's an SSD - this will be faster than the older mechanical hard drives, but they are still not really designed as a substitute for physical RAM and are still many orders of magnitude slower than the dedicated RAM inside your computer. The size of the pagefile is generally recommended to be between 1.5 to 4 times the size of your physical memory.
More Answers (0)
See Also
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!