NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

"Top level objects not released" warning when accessing LabVIEW adapter through API

Solved!
Go to solution

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 

 

problem.png

 

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

0 Kudos
Message 1 of 5
(4,010 Views)
Solution
Accepted by topic author JoeDG

I think you need to close the Module reference that you are getting from the Step.

 

-Doug

Message 2 of 5
(4,005 Views)

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.

Message 3 of 5
(4,001 Views)

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

 

soln.png

Message 4 of 5
(3,998 Views)

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.

0 Kudos
Message 5 of 5
(3,989 Views)