"Memory Is Full" Error in LabVIEW

Updated Sep 11, 2018

Reported In

Software

  • LabVIEW

Issue Details

When I am developing a large application in LabVIEW, I sometimes receive the following error message:
 

 

LabVIEW: Memory is full.

The top-level VI was stopped on the block diagram.

Refer to the VI Memory Usage topic in the LabVIEW Help for suggestions on monitoring and improving VI memory usage.


I have a large amount of available RAM, so why am I receiving this error message?

 

Solution

This error message is typically encountered when developing an application with large data sets of arrays, clusters, or waveforms. Because LabVIEW stores each data set in a contiguous block of memory, the block of memory available on your computer might not be large enough to store a large data set.
 

Below are some suggestions to help prevent this error message from appearing:
 

Reducing Memory Used by Arrays, Clusters, and Waveforms

  • If you have an array with a large data set, if possible, use a smaller data type to represent the items in the array. For example, if the items in the array are represented with double-precision floating-point numbers (DBL), but the range of possible expected values is limited to integers between 0 and 100, you can change the integer representation of the items in the array to unsigned 8-bit integers (U8). The U8 numeric data type uses an eighth of the memory that the DBL data type uses.
  • In LabVIEW 8.5 and later, use the In Place Element Structure to avoid making copies of data when using an array, cluster, or waveform.
  • If you are graphing data from a large array, use max-min decimation to avoid graphing every data point.
  • Use the Profile Performance and Memory tool to help narrow down and identify which VIs are responsible for the memory usage.
  • Analyze the large data set to determine where memory is full. Stream or write the data to disk and use a high-performance analysis and reporting tool, such as TDMS files, and NI DIAdem software.

 

Reducing Memory Usage in Applications

  • To limit the number of times LabVIEW copies data, reduce the number of global and local variables in your application. Instead of using variables, consider using a producer/consumer design pattern, or the New Data Value Reference function to create a reference to the data.
  • Separate large sections of code into subVIs and use the Call By Reference Node to call the subVIs dynamically. A subVI is not in memory until a VI calls it dynamically.
  • Set large subVIs to non-reentrant when possible. Non-reentrant is the default setting for Windows and Real-Time VIs).
  • Use the NI LabVIEW Desktop Execution Trace Toolkit to identify problems that could negatively impact performance such as memory leaks and reference leaks. The toolkit can also collect low-level information such as call chain, thread ID, and location in virtual memory of trace, as well as profile VIs, executables, and shared libraries.

 

Increasing Memory in LabVIEW

Additional Information

This message is most common if LabVIEW cannot allocate a block of memory large enough for an array. For example, a 2D array of double-precision floating-point numbers of size 2,000 by 2,000 elements uses approximately 32 MB. Even if 32 MB of memory is available, you may not have a block of contiguous memory large enough for the array.

This message is also 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 signed 32-bit integer (I32) numeric data type rather than the unsigned 32-bit integer (U32) data type. The most significant bit of the I32 data type is used to specify whether the value is positive or negative.

WAS THIS ARTICLE HELPFUL?

Not Helpful