LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What happends if an array runs out of index

Solved!
Go to solution

Initialize a large array and keep adding elements.

 

I tried with an array of U8's  (to minimize overall size).  I was also tried putting an array on the front panel, setting the index to a large number and putting a value into that element so that it autofilled the array with the default value.  I found that it would not accept the element at a much lower index than the maximum.  Not sure why.  But it didn't crash it that way.

Message 11 of 15
(497 Views)
Solution
Accepted by BombayCoast

OpenSUSE Tumbleweed 64-bit, KDE

LabVIEW Community 20.0.1 64-bit
Motherboard: Asus Crosshair V Formula
Processor: AMD FX-6100
RAM: 16 GB

Swap: 20 GB (only 4 is used in my experiment)
(Mainboard and processor is from 2013)

For me it gives an memory full error when trying to add one more element to full array.

The first peak (small peak) in memory usage is with U8 as datatype (Initializing value).
The big peak is with U64 as datatype (this took ~30 seconds).
I have tried with other datatypes and started with initial array sizes 2147483644 and 2147483646.
It always crashes with (Hex 0x2) Memory is full error when adding 1 more element to array with 2147483647 elements.
For U8 that is 2 GB, for U64 it is 16GB of memory usage.

 

TestMaxArrayIndex.png

Message 12 of 15
(487 Views)

If anyone want to compare results, here is a snippet of my program (if i managed to this correct).

TestMaxArrayIndex_snippet.png

0 Kudos
Message 13 of 15
(484 Views)

Wow I guess it just throws a memory error then. Thank you so much for testing it out! My computer does not have enough memory for this test (16gb). 

0 Kudos
Message 14 of 15
(464 Views)

@RavensFan wrote:

Initialize a large array and keep adding elements.

 

I tried with an array of U8's  (to minimize overall size).  I was also tried putting an array on the front panel, setting the index to a large number and putting a value into that element so that it autofilled the array with the default value.  I found that it would not accept the element at a much lower index than the maximum.  Not sure why.  But it didn't crash it that way.


same here, my .vi crashed, when I tried to "make values default", which appears to be plausible

0 Kudos
Message 15 of 15
(418 Views)