Why Do I Get Stack Overflow Errors with LabWindows™/CVI™?

Updated Jul 19, 2024

Reported In

Software

  • LabWindows/CVI

Issue Details

I keep getting stack overflow errors with my LabWindows/CVI program. What can I do to avoid this?

Solution

Stack space is used by LabWindows/CVI to store automatic variables used in functions. The stack overflow error means that the size of the automatic variables used is greater than the maximum stack size available. There are two typical solutions to this problem:
  1. You can increase the size of the stack by going to Options » Build Options. Note that the stack has a size limit of 2 GB.
  2. You can declare variables as static. They will then be assigned space from the heap instead of the stack. This is especially useful for large arrays.
In order to illustrate the concept of stack overflow, you can find a link to DevX.com. In the Search toolbar, you can type in Stack Overflow and click on the first link that comes up.