LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to close hardware handles without closing Labview

Solved!
Go to solution

A lot of times I have problem with Labview programs:

When I open handles of DLL-s or some hardware handles, then if this handles does not close properly I have to close Labview completely so that Labview releases handles and then I can calculate handles again. 

 

Is there any other way to close, kill, stop al resources directly from Labview without closeing it? Is there any function like "kill-all-handles" or something similar?

0 Kudos
Message 1 of 3
(2,712 Views)

Hi Skoda,

 

how do you open "DLL handles" or "some hardware handles"?

 

Usually there always is a CloseReference function for each OpenReference function.

Examples: OpenFile vs. CloseFile, OpenVIRef vs. CloseReference, AutomationOpen vs. CloseReference, DAQmxCreateTask vs. DAQmxClearTask…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 3
(2,710 Views)
Solution
Accepted by topic author Skoda3

The solution is, as GerdW already pointed out, to keep track of those handles and close them explicitly when you are done with them. That is proper resource handling.

Windows keeps track of all memory allocations and OS handles created within a process and will clean them up when the process terminates but there is NO functionality to tell Windows to close those resources other than terminating the process, simply because you do not want all resources being closed unless the process terminates. If this function would exist and you would call it, the process would crash immediately because that function would inevitably also close resources that your process still is using!

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 3
(2,676 Views)