LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

call setup, load or unload vi in memory

Solved!
Go to solution

hi everyone, i need your help!

 

i have tried to call sub-vis in different ways:

sub1.vi    call setup - load with callers (normally)

sub2.vi    call setup - reload for each call

sub3.vi    call setup - load and retain on first call

sub4.vi    call dynamically with "open vi reference"

 

in main.vi, a event structure and a while loop are used for calling sub-vis

                another while loop (a application property node in it) is used for checking, which vi is in memory

 

after main.vi runs, sub1, sub2 and sub3 are in memory. Only sub4 is not. but i think it is wrong.

in my mind, sub2 and sub3 should not be in memory, because they are not called yet.

can you explain it? thanks.

my english is terrible, i hope, you can understand what i mean.

 

0 Kudos
Message 1 of 12
(4,406 Views)

can anybody help me?

0 Kudos
Message 2 of 12
(4,380 Views)

Note: You can simplify the program by moving the 2nd loop to a timeout case.

 

That's some interesting behaviour, i agree it really shouldn't be in memory, could it be that a VI-ref is in memory but the code isn't?

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 12
(4,372 Views)

This is expected behavior.

You configured the call by reference node to a static bound VI. So the node will pre-load the VI to increase execution performance as the VI can never change.

In the case of "Load with Callers" (first option, "normal subvi"), this is absolutely clear for everyone, i presume.

 

With the two other options, it might appear weird, BUT: Have you tried to open and modify the subVIs while your main.vi is running?

You will see the difference there.....

 

hope this helps,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 12
(4,365 Views)

thanks for your reply.

 

"could it be that a VI-ref is in memory but the code isn't?" --- i don't think so.

 

Lei

0 Kudos
Message 5 of 12
(4,358 Views)

hi Norbert,

 

thanks for your reply.

 

i have tried to open and stop the subVIs while main.vi is running.

ONLY while sub4.vi opened or stoped, the indicator (All VIs in Memory) on the main.vi changed. ---> display or not display the VI name of sub4.vi

another three subVIs have no effect, whether be opened or stoped.

about "modify" what do you mean?

 

Lei

0 Kudos
Message 6 of 12
(4,349 Views)

Lei,

 

unload everything in LV. Restart you main.vi only and execute it.

Now open (manually) sub1, sub2, sub3 and sub4.

Try to modify things in the VIs one after another.

Modify: Move things around, add stuff e.g. an indicator for the loop iterator....

Observe how they behave differently. Close all subVIs.

Now execute the subVIs one after another using your main VI. Once you executed all four subVI, open them again, try to modify things again.....

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 7 of 12
(4,344 Views)

The difference is (Correct me if i'm wrong):

 

The SubVI 1: Always Running

The SubVI 2: The VI goes to idle state when you press the stop button, BUT the reference stays on memory (Static bound)

The SubVI 3: The VI keeps running after the first call (Only unloaded when the Top level.vi goes to idle) 

The SubVI 4: The VI goes to idle state when you press the stop button... if the auto-dispose is true, the reference goes away... if not, you need to close the reference manually (Close Reference function) to avoid any memory leak.

 

 

0 Kudos
Message 8 of 12
(4,335 Views)

thanks for your reply.

 

Jiddu, you are totally right about the difference of the "execution state".

 

0 Kudos
Message 9 of 12
(4,326 Views)

Norbert and Jiddu

 

i still don't understand

 

Norbert, you said "You configured the call by reference node to a static bound VI. So the node will pre-load the VI to increase execution performance as the VI can never change."

Jiddu, you said "BUT the reference stays on memory (Static bound)"

 

BUT i have read this http://digital.ni.com/public.nsf/allkb/387EF1BC4762A96C8625713B007E0032

 

"If you select Reload for Each Call or Load and Retain on First Call, then the VI will be called dynamically when the execution of the code reaches that part of the block diagram. The only difference between these two selections is whether the VI is unloaded from memory immediately after finishing its execution or retained in memory until the calling VI itself closes."

 

the two options: Reload for Each Call or Load and Retain on First Call, static or dynamical, i am confused.

0 Kudos
Message 10 of 12
(4,316 Views)