From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What happends if an array runs out of index

Solved!
Go to solution

Hi I was asked what happens if an array in LabVIEW runs out of index and we keep inserting elements to it. Does it cause a memory overflow? Does it drop the last element in the array? Thanks!

0 Kudos
Message 1 of 15
(1,839 Views)

What does "run out of index" actually mean?

 

You'd probably run out of memory long before you'd ever "run out of index".  Note, the index for an array is based on an I32 integer.  So that means over 2.1 billion array elements.

0 Kudos
Message 2 of 15
(1,794 Views)

Thank you for your response! I was wondering if we actually runs out of those 2 billion index, what would happen theoretically? I was curious because there is no way for me to test it out on my computer.

0 Kudos
Message 3 of 15
(1,791 Views)

The computer will crash, blue screen of death, followed by a loud bang. Results may vary. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 4 of 15
(1,753 Views)

@BombayCoast wrote:

Thank you for your response! I was wondering if we actually runs out of those 2 billion index, what would happen theoretically? I was curious because there is no way for me to test it out on my computer.


Challenge excepted...

 

This is all that happened.

 

array2Capture.PNG

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 15
(1,734 Views)

@RTSLVU wrote:

@BombayCoast wrote:

Thank you for your response! I was wondering if we actually runs out of those 2 billion index, what would happen theoretically? I was curious because there is no way for me to test it out on my computer.


Challenge excepted...

 

This is all that happened.

 

array2Capture.PNG


That is running out of memory, not index. You can initialize an array with the max value of an I32, none larger. You can use a For loop to make an array, but the For loop's N value is I32 bound also. I don't know how can create an array in LabVIEW with more than I32 max elements. LabVIEW doesn't have 64bit array indexes.

 

mcduff

 

 

0 Kudos
Message 6 of 15
(1,726 Views)

I guess I miss understood the question...

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 7 of 15
(1,717 Views)

Hi! What if you use a for loop to fill up an array. Then use the "insert into array" function to insert more elements?

0 Kudos
Message 8 of 15
(1,705 Views)

Let's see, 2147483647 indices, 1 byte minimum per element.

 

2147483647 x 8 = 17,179,869,176 bytes.  I guess you could do it if you tried hard enough.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 15
(1,671 Views)

alexderjuengere_0-1618062091044.png

 

alexderjuengere_1-1618062153061.png

 

 

Message 10 of 15
(1,666 Views)