> I have read that document, and especially in terms of the
> bundling/unbundling, it more or less just states to avoid it which for
> my application may not be the easiest solution. Also, in it a phrase
> reads "Each level of unbundling/indexing might result in a copy of
> that data being generated". I'm trying to figure out when "might"
> becomes "does" or "doesn't". Also, I have seen the consequences of
> using locals, globals and "value" property nodes. I wonder why LabView
> requires making a copy when these are used (because programatically
> within the scope of the diagram they are much easier to use then
> sequence locals and shift registers). thanks.
First, I'll comment on the local and value property. If the AE really
said that pointers are a dirty word in LabVIEW, what they really meant
was that LabVIEW works on dataflow and really doesn't expose the pointers.
The upside of this is that it is much less likely that you will have
uninitialized values, stale pointers, memory leaks, etc. You also have
much clearer idea of what is happening to your data, and parallelism is
much easier to see/use. The downside is that you have less control.
Also, it is best not to think of the reference as a pointer/reference to
data, but instead it is a reference to a UI object, the control or
indicator.
Locals and reference->value are convenient when you are used to writing
lines of code, or expressions that move the data from one location to
another. This code is typically using a sequence to make lines of code
where each of them loads what it needs, modifies it, then stores the
results. Again, this feels familiar, but it is not what works well in
dataflow like LV. It works much better to largely get rid of the
sequences and simply let the data dependency do the work.
Doing this should automatically help your memory usage provided you keep
the items in the performance chapter in the back of your mind. Also,
remember that subVIs normally don't hurt memory usage provided their
panel is not open, and they can even help with memory usage as storage
buffers can be reused.
For the unbundle issue, hopefully your have an array of rather small
records, but in the event you have a record with large arrays, you do
need to avoid repeatedly accessing the elements, indexing, etc. You may
want to build a data access subVI that can do the indexing, searching,
etc in a common location and avoid returning the big arrays. This also
allows for the storage to be moved to a shift register and the whole
thing becomes a functional global.
You might want to spend a little time browsing through the examples for
smart or functional globals as well as some of the analysis ones that
process arrays to see how they deal with the sequencing and wiring.
Greg McKaskle