How to increase the memory that MATLAB uses?
Mostrar comentarios más antiguos
I have 19 GB of memory available for running Matlab. However, Matlab is only using 1 GB of memory. This is adversely affecting my ability to run my code. How do I increase the amount of memory that Matlab is using?
Respuesta aceptada
Más respuestas (3)
April Bryan
el 18 de Mayo de 2018
0 votos
4 comentarios
Steven Lord
el 18 de Mayo de 2018
When you say "permanent increase in memory" do you mean an increase in the amount of memory MATLAB is using (which is easy) or do you mean an increase in the amount of memory available to MATLAB (which may not be so easy.)
Which release of MATLAB are you using?
Are you using a 32-bit or 64-bit version of MATLAB?
Walter Roberson
el 18 de Mayo de 2018
If you are not getting "out of memory", then what adverse impact are you seeing on your code?
Are you running on a system that is being used for other memory-intensive purposes as well, and you want to somehow "reserve" memory for MATLAB so that it does not have to dynamically compete with the other programs that are asking for a lot of memory?
Hoang-Le Tran
el 11 de Dic. de 2023
If I am running on a system that is being used for other memory-intensive purposes, is there a way to reserve memory specifically for Matlab such that there is no competition?
Walter Roberson
el 11 de Dic. de 2023
You just might be able to do that with RTLinux (Real Time Linux), but as far as I know it cannot be done with regular Linux.
For modern versions of MacOS, the most you can do is increase the process priority using the renice utility. Sufficiently old versions of MacOS had other ways available as well.
For Windows, as far as I know the most you can do is increase hte process priority; https://www.auslogics.com/en/articles/change-priority-of-win10-process-with-command-line/
April Bryan
el 21 de Mayo de 2018
0 votos
1 comentario
The memory >> rand >> memory command is only there to show you that Matlab changes it's memory usage dynamically, depending how much memory you need. And how are you removing the memory cap? Is doing a = rand(20000) making your code faster? That is indeed odd, as a = rand(20000) decreases your available memory...
Sometimes the initialization of Matlab is slow, and running a script the first time is slow. Is it still slow when you rerun the same script? Maybe this Q&A is relevant:
Have you tried the profile function to see what is causing your program to run slowly?
%Try this example, directly from "help profile" command
profile on %Begin tracking code performance
plot(magic(35)) %Replace this line with your code summon that's slow
profile viewer %View time to run each line of code. Which one is slow?
Try the profiler first and locate the lines of code that are taking a long time. Without this info and code, it's hard to debug.
Last, use the Comments section instead of the Answer section to respond.
April Bryan
el 21 de Mayo de 2018
0 votos
Categorías
Más información sobre Whos en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!