05-20-2011 11:52 AM - edited 05-20-2011 11:53 AM
I'm having a problem when using the TestStand API in LabVIEW: I'm trying to get the VI path for a TestStand test step, but I'm getting the "Top level objects not released properly" warning. It doesn't look like I'm forgetting to close something, but obviously I am. Snippet is below, and warning text follows. Anyone have any ideas?
I'm using LabVIEW 2010 and TestStand 2010.
This forum has been a huge help. Thanks to everyone!
-Joe
References to PropertyObjects were not released properly. Total number of objects: 418 Number of top-level objects: 7
Note: Some top-level objects may be included if they are referenced by an incorrectly released top-level object. For example, an unreleased SequenceContext object references a SequenceFile object.
The following top-level objects were not released:
Type Definitions [6 object(s) not released] Type Definition #1: Name: FlexGStepAdditions
Type Definition #2: Name: VIParameter
Type Definition #3: Name: VIParameterElement
Type Definition #4: Name: NI_LabVIEWParameterResult
Type Definition #5: Name: Expression
Type Definition #6: Name: Path
And the following uncategoried objects: LabVIEWModule (FlexGStepAdditions) Name: SData
Solved! Go to Solution.
05-20-2011 12:38 PM
I think you need to close the Module reference that you are getting from the Step.
-Doug
05-20-2011 12:53 PM
Doug is correct. The call to "Variant To Data" calls QueryInterface on the Module reference you are passing it. You are currently only closing the reference to the LabVIEWModule.
05-20-2011 01:17 PM
Yep, that worked. I thought that Variant To Data was just converting the module reference to the LabVIEWModule data type, but apparently I was wrong... This TS leak checker is sure making me learn about how to properly close references... I've been programming memory leaks for years!
I was also having problems with LabVIEW crashing after the VI ran, and fixing the order of the close references fixed that, too.
Working code is below.
Thanks a lot (again) Doug.
-Joe
05-20-2011 02:23 PM
I believe it does release it, but only after the VI is unloaded. The leak dialog you get from TestStand happens because TestStand shuts down before the VI was unloaded. I'm not 100%, but I seem to remember that being the case.