05-19-2009 09:02 PM
Ben wrote:he learned that explicitly opening a reference always allocated some memory
This is exactly my concern... I didn't write that in my last reply because I didn't want to appear foolish.
So is my concern a valid one? Does it matter in today's world of ever growing memory (and sloppy use thereof)?
Is this a good practice? Or should it be avoided?
R
05-20-2009 05:31 AM
Ray.R wrote:
Ben wrote:he learned that explicitly opening a reference always allocated some memoryThis is exactly my concern... I didn't write that in my last reply because I didn't want to appear foolish.
So is my concern a valid one? Does it matter in today's world of ever growing memory (and sloppy use thereof)?
Is this a good practice? Or should it be avoided?
R
I advise to avoid it. If your app runs 24 X 7 it is only a matter of time before it will run out of memory.
Ben
05-20-2009 08:49 AM - edited 05-20-2009 08:49 AM
The key to making a cache of references work is to make it exactly that - a look-up table which does not change. It should be set up during initialization and then never needs to be written to again, nor do the references need to be opened again. Yes, caching references does use memory, but if you only have one copy of each reference, it is not that significant. I usually use a shift register wire for this but am playing with using a referenced LabVOOP object. See the next installment of the Xylophone Project, number X, for details. I should have it out in a week or two (life has been busy lately ).
I always close references when I am finished with them, but LabVIEW will clean up references when the VI which opened them leaves memory. Be careful with this. If you have a dynamically called VI which creates references, do not cache these references or they will go bad when the dynamically called VI exits memory.
05-20-2009 12:16 PM
Thanks 🙂
Very good comments. When I created a cluster of references, it was only done once, during initialization (actually.. the verfy first step prior to initialization). It was for a dynamic Operator Interface. It worked very well. I wasn't sure if it was an acceptable practice, so I came up with an alternative implementation solutions since then. However, the cluster of references was then wired to shift registers and extracted/read asneeded.
I would never use dynamic VI's to create references for the obvious reasons.
Thanks for the info. I may actually evolve the present solution again. 😉
RayR