Jump to content

X-Control Owning VI Reference - Do I Have To Close It?


jgcode

Recommended Posts

Does anyone know 100% if I pull the Owning VI reference out of the Container State cluster's Control Refnum - do I have to explicitly close it?

I am leaning towards no given the NI examples (that I have seen) don't and I am thinking it is more of a "refnum constant"?

post-10325-011002400 1287546586_thumb.pn

Link to comment

I'd say no..

My basic motto is: don't close what you didn't explicitly open.

The owning VI is still in memory, even after this call to the facade finishes, so a close will probably be a nop.

The one responsible for actually closing the ref (and thus cleaning up the VI object) is it's initial creator, a specific application instance.

The one thing that's left is the memory location that holds the refnum (pointer to the VI object) and that should be taken care of by the garbage collector as it is for all wires that at some point on the diagram stop and their value is of nu use anymore.

100% sure? I sure hope to be close, otherwise I'm going to have to file a bug report. :rolleyes:

  • Like 1
Link to comment

Cool, I agree with your points above.

From interacting with Project Items tho I have been caught out before not closing refnums, so I wanted to check.

FWIW and off-topic, I was playing around with the Queue implantation above, but scraped it as I didn't like it - back to booleans.

Link to comment

My understanding is that only "Open" functions like Open VI Reference or property/method outputs can generate a reference which needs to be closed, and that sometimes closing those is a no-op, specifically when the reference is to a front panel object. Since your reference is coming out of a cluster, something else (internal to the XControl system) is generating that reference and must take responsibility for destroying it when the XControl is released.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.