05-28-2013 02:03 AM
Hi, just a quick question if anyone can clearify it I would thank you so much.
I found the subpanel example called "Simple Subpanel.vi" and it put an idle while loop to "hold" the front panel of the invoked vi, here it is the "plugin1.vi". (Sorry I'm still not quite clear why it needs the idle while loop here.)
However, if one put the "close vi" after the while loop, like the one I modified, is there a chance that the vi will overflow the PC memory after long time of running? What's the difference of these two methods?
Solved! Go to Solution.
05-28-2013 02:23 AM
05-28-2013 07:51 AM
Close the reference when you are done with it. If you were to modify the VI in the subpanel, while it is in the subpanel you may need the VI reference, and closing it before using it would cause the reference to become null.
@thitchen007 wrote:
However, if one put the "close vi" after the while loop, like the one I modified, is there a chance that the vi will overflow the PC memory after long time of running? What's the difference of these two methods?
Why would closing the reference after the while loop cause memory to grow? The only reason LabVIEW's memory would grow is if you opened new VI references, but never closed the old ones.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
05-28-2013 12:39 PM
By "modify the VI in the subpanel", you mean interacting with the front panel of the vi in the subpanel? What I can see here is that when it's running, the given LabVIEW example "Simple Subpanel. vi" closes the reference before the while loop stops, but I can still switch buttons on the front panel of the vi in the subpanel, sorry I didn't quite follow you here.
Or you mean in the block diagram where I need to modify the VI? That should be done before closing the reference?
Hooovahh wrote:
Close the reference when you are done with it. If you were to modify the VI in the subpanel, while it is in the subpanel you may need the VI reference, and closing it before using it would cause the reference to become null.
thitchen007 wrote:
However, if one put the "close vi" after the while loop, like the one I modified, is there a chance that the vi will overflow the PC memory after long time of running? What's the difference of these two methods?
Why would closing the reference after the while loop cause memory to grow? The only reason LabVIEW's memory would grow is if you opened new VI references, but never closed the old ones.
I'm just debugging a bigger program and just want to eliminate possible reasons one by one. Thank you for the comment!
05-28-2013 12:45 PM
Lets say I load my VI into a subpanel, then after it is in the subpanel I want to show or hide the menu bar. I can use a Property Node to show or hide the menu bar of the VI in the subpanel, but I can only do this using the reference to the VI if it hasn't been closed yet. In this case you don't want to close it until you are done with it.
You are not leaving references opened indefinitely in either case you showed, so there is no memory issue with either method.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
05-28-2013 12:46 PM
The "Best Practice" here is to set "AutoDispose" = TRUE and not to use the Close Ref at all.
05-29-2013 12:14 AM
Thanks for your illustration, kudos for you!
@Hooovahh wrote:
Lets say I load my VI into a subpanel, then after it is in the subpanel I want to show or hide the menu bar. I can use a Property Node to show or hide the menu bar of the VI in the subpanel, but I can only do this using the reference to the VI if it hasn't been closed yet. In this case you don't want to close it until you are done with it.
You are not leaving references opened indefinitely in either case you showed, so there is no memory issue with either method.
05-29-2013 12:17 AM
@JÞB wrote:
The "Best Practice" here is to set "AutoDispose" = TRUE and not to use the Close Ref at all.
The subvi's in the subpanel's will not stop by themselves, so it might not work here.
Thanks for the comment!
05-29-2013 11:10 AM - edited 05-29-2013 11:11 AM
@thitchen007 wrote:
@JÞB wrote:
The "Best Practice" here is to set "AutoDispose" = TRUE and not to use the Close Ref at all.
The subvi's in the subpanel's will not stop by themselves, so it might not work here.
Thanks for the comment!
That's OK that the sub-vi closes whenever, AutoDispose handles that by closing the reference when it is no longer needed. Really, Auto Dispose is a nice feature
05-29-2013 01:14 PM
@JÞB wrote:
@thitchen007 wrote:
@JÞB wrote:
The "Best Practice" here is to set "AutoDispose" = TRUE and not to use the Close Ref at all.
The subvi's in the subpanel's will not stop by themselves, so it might not work here.
Thanks for the comment!
That's OK that the sub-vi closes whenever, AutoDispose handles that by closing the reference when it is no longer needed. Really, Auto Dispose is a nice feature
Ok, I'll try it out, thanks for the comment!