Jump to content

Purpose of Close Reference


hooovahh

Recommended Posts

I understand cleaning up references is generally a good thing, but is there a reason the JKI State Machine attempts to close the This VI reference of a VI that is in memory? This in my mind is basically a no-op and can be removed because the close can't remove the VI from memory since that is the VI that is running.

 

Which brings me to question why we even get a copy of the This VI reference and put it in the shift register. If you have a property or invoke node set to the VI Server class "VI" then you can leave the reference unwired and it assumes "This VI", which is actually seen in the "Initialize Core Data" case.

 

Is there a good reason to keep a copy of This VI in the cluster? And if so is there a good reason to have a Close Reference in cleanup?

Link to comment
Share on other sites

  • 2 years later...
On 6/2/2015 at 10:30 AM, hooovahh said:

I understand cleaning up references is generally a good thing, but is there a reason the JKI State Machine attempts to close the This VI reference of a VI that is in memory? This in my mind is basically a no-op and can be removed because the close can't remove the VI from memory since that is the VI that is running.

Which brings me to question why we even get a copy of the This VI reference and put it in the shift register. If you have a property or invoke node set to the VI Server class "VI" then you can leave the reference unwired and it assumes "This VI", which is actually seen in the "Initialize Core Data" case.

Is there a good reason to keep a copy of This VI in the cluster? And if so is there a good reason to have a Close Reference in cleanup?

 

Hey Brian.  I just asked about this, and the primary thinking is this: even though it's a no-op, it serves to document how to user the "Data: Cleanup" frame.

image.png

Also, in the case where someone might change the VI Reference constant to an Open VI Reference, it's helpful that we're actually closing it. Why would someone call Open VI Reference? I'm not sure, but one thing I thought of is when a VI wants to hold a reference to itself open, so that if it's Front Panel isn't visible and it's running because someone else opened it by reference to it, then it won't be "garbage collected" (aborted and destroyed) when the reference count goes to zero (since it won't go to zero if it opens an explicit reference to itself). 

image.png

Does that make sense? Do you have any thoughts about that?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

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