LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Question about opening a vi reference in a sub-vi in a loop

I have a weird question that has to do with a performance change I saw between Labview 7.1 and 8.2.  Maybe someone knows something about this.
 
Basically when I upgraded to 8.2 I found a couple of memory leaks in my code.  They didn't really cause memory to increase actually, but they caused labview to take several minutes to close if I hit the abort button.  I tracked it down to a couple of spots where I was inadvertently calling a vi reference in a sub-vi in a loop.
 
So if I run this in either 7.1 or 8.2, I can call hundreds of thousands of instances of the vi ref in a loop.
 
 
 
But if I take the above code and sub-vi it like this:
 
 
Now if I run this for a couple seconds labview takes a long time to close, and if I run this for several minutes labview will basically hang entirely when I abort the vi.
 
But if I do the same thing in Labview 7.1 the performance is exactly teh same regardless of whether the open vi reference is in a sub-vi or not.
 
So what changed?  I don't really care about the difference, as I probably shouldn't be doing this in a loop anyway, but what is different in 8.2 that caused the change?
-Devin
I got 99 problems but 8.6 ain't one.
0 Kudos
Message 1 of 11
(3,661 Views)
Small sidenode in LV 8.2 you have a "this vi" reference in the application pallett so y7ou dont need any code to get a self ref to a vi.
 
Paul
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 2 of 11
(3,646 Views)
Opening millions of new references without ever closing any has always been something that should be avoided at all costs.
 
Sorry, I don't know if anything has changed between versions.
0 Kudos
Message 3 of 11
(3,637 Views)

Of course, but I am interested in knowing what changed, just for my own edification. 

Obviously something changed between the two versions.  And what is strange is that there is no problem at all opening millions of vi references as long as I am not passing the reference control out of a sub-vi terminal.

There is an openG function that did this exact function, and I was actually using it in one of the states in a state machine.  So the state machine would continually go through a repeating cycle, and after several days I would start to notice labview would take forever to close if I stopped the vi.  So its not like I did something as noticably dumb as the example I showed, but it is interesting to me what is actually occuring inside labview here, and why it didn't have a problem in 7.1.  I find the more i know about the innards of labview's memory allocation and management, the easier it is to good-performing code.

-Devin
I got 99 problems but 8.6 ain't one.
0 Kudos
Message 4 of 11
(3,628 Views)
 
 
falkpl,
 
I'm not seeing it.  Are you sure its in application control?
 
 
I'm interested in trying it to see if it is actualy opening a new reference every time you use it.

Message Edited by billings11 on 09-27-2007 12:48 PM

-Devin
I got 99 problems but 8.6 ain't one.
0 Kudos
Message 5 of 11
(3,622 Views)
You mean to use the static vi reference and link it to the vi?  I tried that and interestingly it is not actually opening a new application reference each time.  Its just giving access to the same reference over and over again I guess.
-Devin
I got 99 problems but 8.6 ain't one.
0 Kudos
Message 6 of 11
(3,618 Views)

Yes I was refering to the vi ref.  When you select it it comes up as "this vi".  Just a little easier then opening a reference to the current vi's location.

 

Paul 

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 7 of 11
(3,611 Views)
When I select it and drop it on a diagram it comes up with a question mark and the run arrow is broken until I select a vi by file path.  I don't see any option for "this vi".
-Devin
I got 99 problems but 8.6 ain't one.
0 Kudos
Message 8 of 11
(3,581 Views)

Sorry I should be more exact, I meant the vi server ref not static vi ref.  Is this the ref you used?  It should link by default to "this vi".

 

Paul

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 9 of 11
(3,579 Views)
I see its the VI Server reference.

Message Edited by billings11 on 09-28-2007 02:58 PM

-Devin
I got 99 problems but 8.6 ain't one.
0 Kudos
Message 10 of 11
(3,573 Views)