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
(350 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
(305 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
(302 Views)

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


aputman
LabVIEW 2017
LabVIEW Programming
Message 4 of 15
(264 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

-------------------------------------------------------------------
Unfortunately, most readers of this Forum, including some real Experts, have not mastered the skill of being able to read the code that Posters fail to post. If we cannot see "what you did wrong", we are unable to tell you how to fix it. (Bob Schor 28 August 2018)
0 Kudos
Message 5 of 15
(245 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
(237 Views)

I guess I miss understood the question...

-------------------------------------------------------------------
Unfortunately, most readers of this Forum, including some real Experts, have not mastered the skill of being able to read the code that Posters fail to post. If we cannot see "what you did wrong", we are unable to tell you how to fix it. (Bob Schor 28 August 2018)
0 Kudos
Message 7 of 15
(228 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
(216 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
(182 Views)

alexderjuengere_0-1618062091044.png

 

alexderjuengere_1-1618062153061.png

 

 

Message 10 of 15
(177 Views)