Nice test vi's there. I really like that. Does anyone know if we can use labview to show us the memory load of the different runs?
I'm going through a large project trying to improve performance and track down a bug so now I'm looking at refs deeper than ever. I created this little thing because I use refs in many different places, and I've got a number of concurrently running subvis that all interact, and wanted to know when to close refs and when to leave them open.
It seems to me here that for controls closing them makes no difference at all. You can see that I created 2 arrays, holding the refnum and label of each control on the front panel. But I did this after closing the references. Ok no big deal since I took the input for the property node before I closed the refs, so their numbers are stored in the for loops node. But then I send this to a subvi that gets opened afterwards, and it does a strict property node read of those numbers and they still give the correct labels. It seems to me that as long as the front panel is open labview maintains the same refnum for each control, and won't close the refnum because the panel is still using those controls. I'm more convinced of this because when I put probes where the black arrows point, that no matter how many times I run through the while loop, the refnums never change, and all 3 probes show the same numbers. And when I do kill the top process then run it again the refnums of the controls are different then. So it would seem that if you are taking refnums to controls from a panel that will be opened and closed repeatedly then it would make sense to destroy those refnums, er close the refs.
SO then to check out how it affects vi refs I put the close ref at the end of the panel read, where the red arrow is. Each successive loop shows a new refnum in the probe. If I do not close it there, and put a probe before the panel read where the blue arrow is, the refnums also change in that probe. Which leads to think that there is a memory difference for vi's, even when within itself.
So then to be a smart alec I decided to pass the close fron panle ref to the subvi, and sure enough it blows up with an invalid reference error like we'd expect. Of course if I abort the top vi the subvi dies before I can finish that test. I think what I need to do is make the top vi call a subvi and get refs from the subvi that the top will try to use after closing the sub....
So I decided to use a static vi ref to do that, and well putting a probe on it, even with closing it ech time, the refnum stays the same through the loops, i.e. the word "static" i suppose. It does change when I abort the top vi and make a new run. Maybe I could use something with a queue from the subvi to try out more refnum experiments...
Now if I leave the ms wait timer on 1 ms.... after a few seconds it closes quickly, no probs. After only a minute... when I hit abort it takes its sweet little time to close. This is with me killing the static vi refnum eaech cycle which of course does nothing. But not killing the self-refnum. When I do kill the self-refnums it doesn't matter how long I leave it up and running it still aborts as quickly as if I did it just after run.
So it seems that any time a vi is called by a non-static refernce, which could be every other kind, i'm not testing them all right this minute, its going to be generating more overhead and would be better closed. For front panel controls, if the vi they're on is closed and opened again they too will have a new set of refnums, and the consequential overhead involved.
Does this seem to fit with what the starter of our thread showed us?
And again how can we measure the memory usage?