I'm sure there is a better solution, even if the 2D array is being filled from various modules at various times.
A single copy of your array in memory is already about 80MB (if DBL) and if you are not careful with coding, you might easily generate 10 copies of it and constantly copy the entire thing back and forth between different locations.
Have a look a application note 168:
LabVIEW Performance and Memory Management
. Every read operation from a global variable generates a copy of the data!
(Bart Simpson (as a LabVIEW programmer) would probably need to write the following quote 100x on the blackboard: "
Do not overuse glo
bal and local variables when working with arrays or strings. Reading a global or local variable causes LabVIEW to generate a copy of the data.")
🙂I would store the full array in a "functional global" (LV2 style global), i.e. in a shift register of a subVI. Keep the insert point in another uninitialized shift register. Notice that each "append" call only requires transfer of a single row, the calling VIs thus don't need to read out an extra copy of the full huge array for each append operation. Place a case structure inside the storage VI where you can select various modes (initialize, append, read out, save to disk, get average of column x, etc.) such that most operations remain local to the "functional global" and don't need shuffling of huge arrays back and forth.
How often do you need access to the full array? Another possibility might be to go directly to disk and append each row as a datalog record. It will be easy to later retrieve a few interesting row and memory us
e will be very light.