LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Do I need to close ActiveX references?

Hi,
I am developing a library of VIs that use ActiveX to control APWin (for Audio Precision System Two) with LabVIEW where both are running on the same PC and I am wondering if I need to close ActiveX refnums when I'm finished along a particular heirarchy level. The context help says that LV closes references when they're no longer needed but is it bad practice to leave them open? Can not closing refnums potentially cause problems? See attached picture for an example.
Thanks,
Sara
0 Kudos
Message 1 of 5
(3,480 Views)
Better to close ActiveX references explicitly for free up memory when no longer needed.

A Rafiq
0 Kudos
Message 2 of 5
(3,480 Views)
Sara,

The help says:

"LabVIEW closes control references when that reference is no longer needed.
You do not have to explicitly close control references. "

The references in your examples are not control references, and they need to
be closed. You will get problems when you leave them open. To test this, put
all code in a while loop and run it. See if the needed memory is increasing
(with performance monitor). If it is, you have a memory leak. If you run the
code only once (e.g. for opening or initialization), you might never notice
the leak, but it is still better to close all opened references.

Also note that references are not closed by closing a parent reference. And
if you get two references to the same thing, both references have to be
closed.

Rega
rds,

Wiebe.


"Sara2004" wrote in message
news:5065000000080000007AE90000-1079395200000@exchange.ni.com...
> Hi,
> I am developing a library of VIs that use ActiveX to control APWin
> (for Audio Precision System Two) with LabVIEW where both are running
> on the same PC and I am wondering if I need to close ActiveX refnums
> when I'm finished along a particular heirarchy level. The context help
> says that LV closes references when they're no longer needed but is it
> bad practice to leave them open? Can not closing refnums potentially
> cause problems? See attached picture for an example.
> Thanks,
> Sara
Message 3 of 5
(3,480 Views)
Thanks for your response. This is good to know. I'm assuming the same is true for MSWord and MSExcel report refnums...is this a correct assumption?

Thanks so much for your help.

Sara
0 Kudos
Message 4 of 5
(3,480 Views)
Sara2004 wrote:
> Thanks for your response. This is good to know. I'm assuming the same
> is true for MSWord and MSExcel report refnums...is this a correct
> assumption?

You should generally close any refnum. LabVIEW 7 does have improvements
to its own refnums (App and VI refnums, Control refnums) which does not
require to close them anymore but doing so will definitly not hurt.
For Active X refnums, in the best case they just use up memory until you
close the entire application or the LabVIEW development system. In the
worst case the system can crash when you close the executable or LabVIEW
due to the Active X component stumbling over left open object references
when Windows forces those objects to be closed on behalve of the leaving
execu
table.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 5 of 5
(3,480 Views)