What is the Maximum Size of an Array in LabWindows™/CVI™?

Updated Apr 25, 2023

Reported In

Software

  • LabWindows/CVI

Issue Details

What is the maximum array size in LabWindows/CVI? Is it the same thing as a maximum stack size?

Solution

The maximum array size in LabWindows/CVI is 231 (2,147,483,648) elements, which is the same as the maximum struct size. This is different from the maximum stack size. The stack is used for passing function parameters and storing automatic local variables, and is a unrelated to arrays. 

Additional Information

Note: The maximum stack size in LabWindows/CVI is 2 GB, the minimum stack size is 100 KB, and the default stack size is 250 KB. Please refer to LabWindows/CVI Programmer Reference Manual, which ships with LabWindows/CVI, for more information.

If you are creating an array that is larger than the 2 GB maximum stack size, you can dynamically allocate memory for an array using the calloc() function. Doing this will pull memory space from the heap instead of the stack, which has a lot more accessible memory. However, if you do dynamically allocate memory, be sure that you free the allocated memory space at the end of its use to prevent issues later on.