Can I fix 'Out of Memory' error by attaching an external drive?

11 visualizaciones (últimos 30 días)
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 comentario
Stephen23
Stephen23 el 13 de Abr. de 2021
Editada: Stephen23 el 13 de Abr. de 2021
You might be confusing computer memory with your hard-drive storage:
  • 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.
"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).

Iniciar sesión para comentar.

Respuesta aceptada

David Fletcher
David Fletcher el 12 de Abr. de 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 comentarios
Lina Gannon
Lina Gannon el 12 de Abr. de 2021
Thank you! I just tried making more space on my computer, I have 50/117 free GB, is that a lot or a little? last week my code was working mostly so I am not sure what could be going on.
Thanks!
David Fletcher
David Fletcher el 12 de Abr. de 2021
Editada: David Fletcher el 12 de Abr. de 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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by