LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Unduly high memory usage of Mathscript nodes

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 ?

0 Kudos
Message 1 of 4
(2,116 Views)

There is a special forum for Mathscript questions and I would recommend to post there. Do a search there and you''ll find a few related discussions (for example here, and here), all are quite old.

 

You did not say what version of LabVIEW you are using, but mathscript has improved somewhat over the years in this respect.

 

What does your mathscript node actually do? What is the datatype of your arrays? Would it be easy to do the same calcuation in plain LabVIEW?

0 Kudos
Message 2 of 4
(2,103 Views)

I had terrible memory problems getting Mathscript to work. I partly solved it by splitting up the mathscript code into nodes of no more than 10 lines, and using the latest version of LV. It is counter productive but did the trick. It still takes a minute or two to open a VI with mathscript nodes though.  

0 Kudos
Message 3 of 4
(2,101 Views)

I'm using a quite recent Labview (2011 I guess).

My point is not to reproduce the same functionality using standard Labview nodes - I'd like to fix my Mathscript node 🙂
I will have a look at the forum you mention.

0 Kudos
Message 4 of 4
(2,087 Views)