在使用matlab parallel server工具箱做并行计算时,怎么计算一个程序使用的内存峰值?(不是使用memory得到的累计内存)
1 view (last 30 days)
Show older comments
我要对比两个方法求解一个问题的内存,如果使用memory来计算的话,得到的内存是一样的,这肯定不对,我要的是计算一个程序时,这个程序的内存峰值。
0 Comments
Answers (1)
Govind KM
on 23 Jul 2025
Using Google Translate, I gather that you wish to calculate the peak memory usage of a program, without the use of the "memory" function.
Kindly refer to the following MATLAB Answers post, which provides a function to help monitor memory usage: https://www.mathworks.com/matlabcentral/answers/97560-how-can-i-monitor-how-much-memory-matlab-is-using. The program uses the "whos" command, but automatically does it for variables in the base workspace. This can be adjusted to be evaluated in the function work space, which might be of use to you when trying to evaluate peak memory usage.
The parallel profiler could also be of use to you. More details can be found in the documentation page: https://www.mathworks.com/help/parallel-computing/profiling-parallel-code.html
Hope this helps!
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!