LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What happens when resources are not closed?

Solved!
Go to solution

So I have been running LabVIEW automation for a while now and have been sloppy about closing things like VISA resources. 

 

My Question is: what happens to an opened VISA resource when a LabVIEW application or VI is closed or is stopped?   ...does it open a process every time and the build up over and over until you have several tied up resources?  ...or do the resources get released simply by closing the program or stopping the VI?

 

If the first, then that is a real problem and I need to make sure I close or release the resource. 

If the second, why should I care about closing a VISA resource???

 

And not just VISA but any resource that LabVIEW ties up at runtime...

Thanks!
John Hess
Certified LabVIEW Associate Developer
0 Kudos
Message 1 of 3
(879 Views)
Solution
Accepted by topic author EthanTheHut

@EthanTheHut wrote:

 

My Question is: what happens to an opened VISA resource when a LabVIEW application or VI is closed or is stopped?   ...does it open a process every time and the build up over and over until you have several tied up resources?  ...or do the resources get released simply by closing the program or stopping the VI?

 


Back in Windows XP days the resource will still be tied up if you didn't close the VISA session. That is if a com port is not closed then other programs can not access it. I have also seen instruments that will not automatically switch back to manual mode if their VISA resource is not closed leaving the instrument front panel locked and have to be manually switched out of remote mode.

 

But that being said I believe newer versions of Windows and LabVIEW are better at releasing these resources even if you don't explicitly release them in your program.

 

Also there is an option in LabVIEW to Automatically close VISA sessions, this may be why things work better now. 

 

But honestly it's just "bad practice" and even could be called "lazy" to not close any resource, file, etc. that your program opens.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 3
(870 Views)

Thanks for that great information!

 

I need to stop being lazy for sure. It is something I need to add to a large automation platform I built. Its a QMH with and event driven front panel that runs test scripts that control the VISA equipment. I just need to add a case that executes when it closes that goes and releases all the open resources. 

Thanks!
John Hess
Certified LabVIEW Associate Developer
0 Kudos
Message 3 of 3
(863 Views)