08-24-2007 08:17 AM
Hi Gabi1,
repeatedly opening and closing ref's will eat up memory because there are resource allocated for each open. The close does not delete these resource (memory) but only marks them as availbe for deletion. The clean-up only happens when the VI goes idle.
So...
Open outside the loop and close ONCE after the loop.
And yes, writing to a local is prefered because locals do not have to switch to the UI thread to work.
Ben
08-24-2007 07:32 PM - edited 08-24-2007 07:32 PM
Message Edited by jccorreu1 on 08-24-2007 07:34 PM
08-25-2007 08:56 AM
thanks guys for the answers. i am still quite a bit confused, but the rule seems to be:
Always close a reference!
thats a bit too bad, because that means cluttering up quite a bit the code, either with wires to the references and a lot of connections to the loops, or with request deallocation icons all over! according to what i understand that would not even help actually.
so if i have a program with say 50 controls and indicators, in order to access them i will need 50 (!!) reference wires that enters the loops, the event structure, and so on...
so here is my questions:
1) do we have possibility to have pointers to variables?(never saw any such thing in LV)
2) if i have a local in a loop, is the variable duplicated only once, or every time the loop perfoms? if the first is true that would mean it is just generally much better to have locals than references (for cases where applicable). if the late is the right one, then we are doomed to horrible wiring using the references...
08-27-2007 05:26 PM