Why Do I Receive a "Memory Is Full" Error When Using a For Loop in LabVIEW?

Updated May 3, 2018

Issue Details

When using a large array to index a For Loop users may get the following memory error when running their VI's:

Solution

This error is generated when an array containing more than 2^31 elements is used to index a For Loop. Arrays can contain up to 2^32 elements, but a For Loop can only index up to 2^31 values. This is because the N terminal uses the I32 datatype rather than the U32. The most significant bit of the I32 datatype is used to specify whether the value is positive or negative.

To get around this limitation, you can:
  • Replace your For Loop with a While Loop and compare the iteration value to the size of the array, terminating when the two are equal.
  • Split your array into two smaller arrays.

WAS THIS ARTICLE HELPFUL?

Not Helpful