LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I make sure all of my VI's and globals are loaded into memory in and stay in memory in LabVIEW 8.5

In LabVIEW 7.1 and all previous versions, we have a top level VI that has our main test modules and our global variables in it's diagram.
We make this a subvi to another vi that is put into the windows startup folder. This way all of our VI's are loaded into memory at bootup.
This makes it easy for development to find VI's, speeds things up so Test Stand doesn't need to load and unload VI's when it's calling the VI's and it keeps the few global we use in memory. It seems that LabVIEW 8.5 behaves a bit differently. It does not always seem keep all of the  VI's and globals in memory
if they are not being used (this top VI is not running, we have always used it to hold all of our code in memory). I guessing it is trying to clean up memory. Is there a way to force LabVIEW 8.5 to load all the subvi's ( including global vi's) of the caller VI into memory and never unload anything from memory even if the non of the VI's are running?
0 Kudos
Message 1 of 7
(3,299 Views)

Hi Hollister,

Sub-VIs and global variables should be in memory as long as a VI that calls it is open.  I have tested this in 8.5, and the VIs are loaded into memory even if the program is not run.  You can check the status of memory in LabVIEW by selecting Tools>>Profile>>Performance and Memory.

What is the exact behvioral difference you have seen between the different versions?  Does the top level VI remain open the entire time?

Regards,

Lauren

Applications Engineering
National Instruments
0 Kudos
Message 2 of 7
(3,259 Views)

I have noticed that the subvi's are not in memory even if the main VI is open.

I know this because when I double click on the subvi I see the LabVIEW GUI  opening up all the subvi's.

I forgot to mention that a lot of the code is inside case statements that are hardwired to FALSE. The subvi's are inside the TRUE cases.

Is it possible that LabVIEW is decides that it doesn't need to load the subvi's because the TRUE case can never be executed?

0 Kudos
Message 3 of 7
(3,257 Views)

Hi Hollister,

With LabVIEW 8 and newer, the application tries to save memory by only loading the necessary subVIs into memory.  This means that any VI that cannot be executed at runtime (such as one in a true case that has a false constant wired to it) will not be loaded into memory.  Is it possible to modify your program so that the necessary VIs would be loaded according to this new structure?

Regards,

Lauren

Applications Engineering
National Instruments
0 Kudos
Message 4 of 7
(3,234 Views)

I can modify the code if this is the only solution. Is there any way to turn off this automatic memory saving feature that was added to LabVIEW 8 and higher?

Memory has not been a problem for me. I would prefer to have the ability to turn this new feature on or off.

0 Kudos
Message 5 of 7
(3,225 Views)
Hollister,

One trick you can use to fool the compiler into thinking that the VIs might run is to replace the boolean constants with a control. Because the compiler does not know if the control will change values, it will load all the code.

Lynn
0 Kudos
Message 6 of 7
(3,212 Views)
A better way (in fact the recommended way) to keep a subVI in memory without having to functionally call it is to use a static reference from the Application Control palette. If you have a static reference to a VI on a block diagram of another VI, it will be loaded into memory with that VI and stay in memory as long as that VI does, even though that VI isn't calling it.

See here for more information.






Message Edited by Jarrod S. on 04-04-2008 03:49 PM
Jarrod S.
National Instruments
Message 7 of 7
(3,206 Views)