02-21-2012 09:31 AM
I have an application where there are several front panels that I would like to have open at once, but where when they stop they would close. I was using the scripting function fp.close - but as the application has got more complicated this seems to work less and less well. Basically when i hit close, the system hangs for a few seconds, then the time critical stuff i have tends to timeout and then crash, and everything goes funny for a while.
My (uneducated) guess is that when it closes a front panel it drops loads of stuff straight out of memory - in an uncontrolled way.
After going for a cup of coffee it usually sorts itself out. But clearly this isn't a sustainable solution for my application or my kidneys.
Am I doing something wrong? - Is there something i should do to allow the Vi to finish before i try to close it? Should i be releasing references or somethign to make things better. I thought about running the close vi sub as a new thread - but not sure if this would actually do anything different.
Attached - the subroutine that i pass a vi ref to.
02-21-2012 09:57 AM
There's nothing in the attached VI that would necessarily cause your problem. I would, however, suggest that you feed your reference through the nodes in proper flow control method rather than branching off like you've done.
When a VI fails to close quickly, I have most often found it's due to open references which aren't explicitly closed. File references, VI references, multiple calls in a loop acquiring the same reference over and over without releasing it, .NET calls not being closed - that kind of thing.
02-21-2012 01:01 PM
Hmmm.
That might make some sense. I have a feeling i may have some queue references left over somewhere. Also some of my measurement data objects. One quick question - with data objects without 'references' to active objects - ie with just arrays of values is it necessary to create a destroy method for each one - I was doing this at one point but I thought I had read somewhere that it wasn't necessary.
02-21-2012 01:08 PM
Dynamics need closed statics do not. OYu can tell the difference (with time by just looking) but when learning you can use a type cast fucntion (see data minupulation palette) and cast the ref as a U32 and an indicator for same. It the U32 values changes when you run the VI, it is dynamic.
Ben