NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Releasing object referrences from station variables

I am creating object referrences for both Active X and .NET components.  These objects must be used throughout multiple sequences within the mainsequence.  I am looking at relaesing the objects at the end of the mainsequence, but so far, all I can currently do is use an expression statement and state

 

objectreferrence = ""

 

Is there a better way to do this.  I have tried setting equal to null, but that is coming back as invalid.

0 Kudos
Message 1 of 4
(2,927 Views)

Set to object to Nothing

 

eg

Locals.SeqObj = Nothing

 

 

Regards
Ray Farmer
0 Kudos
Message 2 of 4
(2,926 Views)

In addition to Rays correct answer, you should make sure that the objects do not provide a dedicated shutdown routine.

Simply setting the reference to Nothing will free tha handle, but this could lead to object leaks.

 

hope this helps,

Norbert

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

The handle is one concern to make sure that the object can be created and used again.  Also, the leaks are my biggest concern.

0 Kudos
Message 4 of 4
(2,918 Views)