12-04-2015 03:48 PM
Hi,
I have a set of 7 shared variables that are initialized as 1-D arrays with 30 SINGLE elements with a value of 0. I would like to call the initialize array.vi only once and just wire it to each of the 7 write node vi's for the shared variables. Each of the arrays will then be populated with various measurement data later in the program.
My question is, does LabVIEW pass by reference, or by value when wiring the resulting array to each of the 7 write nodes? If it passes by reference, each of the 7 variables will all reference the same block of memory. If it passes by value, 7 different blocks of memory will be created in addition to the original block created by the initialize array vi.
If by reference, then I will need to place 7 different initialize vi's. If by value, then I only need to place it once.
Thanks for clarifying,
Chris
12-04-2015 03:54 PM - edited 12-04-2015 03:55 PM
Hi geo,
just use one InitArray and branch the wire. LabVIEW does all the memory management for you!
(General answer : LabVIEW uses DATAFLOW, values are usually sent by wires and passed by value.)
If by reference, then I will need to place 7 different initialize vi's. If by value, then I only need to place it once.
That's irrelevant!
Each SharedVariable maintains it's own memory buffer…