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.
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.
04-09-2021 11:41 AM - edited 04-09-2021 11:42 AM
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!
Solved! Go to Solution.
04-09-2021 12:38 PM
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.
04-09-2021 12:40 PM
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.
04-09-2021 03:46 PM
The computer will crash, blue screen of death, followed by a loud bang. Results may vary.
04-09-2021 08:35 PM - edited 04-09-2021 08:36 PM
@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.
04-09-2021 09:13 PM
@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.
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
04-09-2021 09:31 PM
I guess I miss understood the question...
04-09-2021 10:03 PM
Hi! What if you use a for loop to fill up an array. Then use the "insert into array" function to insert more elements?
04-10-2021 05:19 AM
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.
04-10-2021 08:42 AM