05-28-2012 09:10 AM
After a few "Not enough memory" errors in my Labview program, I decided to investigate in order to find out what part of the program was being too memory-hungry.
I finally traced this issue to a sub-VI of mine that uses a Mathscript node. The node in question was using 500 MB (!) of RAM to generate a few arrays whose total size shouldn't have been more than a few 10's of MB.
I ran some tests and noticed that the Mathscript node seems to use too much memory even for simple operations. I don't have precise figures here, but it I had the impression that it wasn't too good at clearing unused variables during the script. Furthermore, using the "clear" command manually (as used in Matlab) leads to silly errors when executing the VI.
I solved the problem by trading my Mathscript node for a Matlab Script node (which calls Matlab through an ActiveX call), and Matlab does the job nicely and quickly without any error (even though I admit that I don't know how much memory Matlab itself used for this, but it didn't seem to burden the PC too much).
This leads to the question: Are Mathscript nodes notoriously memory-hungry, and if yes is there a way around this ? (I admit that they are quite useful, or at least they would be without this issue). If not, what mistake could I have committed ?
05-31-2012 03:27 PM - edited 05-31-2012 03:30 PM
Would you be willing to post your VI with some useful initial data so that we might investigate this issue? Alternatively, you could pm me for an address to send it via email if you wish to keep it private. Also, what versions of LabVIEW and MathScript are you using?