Memory Management in Matlab 2016b on Linux servers

1 次查看(过去 30 天)
I run a large data processing Matlab program that contains both scripts and MEX functions. Some MEX functions use mxCreateNumericArray to return results to a script. I have read that it is not advisable to try to pass in an array created by a script and have a MEX file return results in that array; e.g. in place operations as in: a = zeros(10, 10); mexFUN(a).
I have read this is possible but very ill-advised and runs the risk of corrupting other arrays associated with the array a because of the way Matlab manages memory.
I also know that outside the MEX function one cannot use mxDestroy to clear the memory used by a.
Once the script finishes the virtual memory used by the script is still allocated to Matlab and a second large job usually fails.
1. Is there a way to manage - create and clear - memory that must be accessible to both MEX functions and scripts calling the MEX function.
2. Is there a way to clear all of Matlab allocated memory after a script returns?
I am using Matlab 2016b on Linux servers.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by