Memory Management in Matlab 2016b on Linux servers
1 view (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Resizing and Reshaping Matrices 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!