LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

stack overflow

i tried to create a int array of size of 139351 x 1909

However a fatal runtime error occurs. The msg is

The program has caused a 'Stack overflow' fault at 001B:0040690C

How do i solve this? does CVI allow us to increase the stack size?

Thanks.
0 Kudos
Message 1 of 4
(4,650 Views)
In your project window, goto Options >> Build Options. You can increase the Maximum Stack Size there. For additional hints, search CVI help for Stack.
0 Kudos
Message 2 of 4
(4,650 Views)
Hi there, I have tried that and increased to the maximum bytes = 1,000,000. But still it is not enough. I wonder if it is possible to increase higher as i calculated that an integer array of 139351x1909 is about 266 million elements => 266x4 MB!!! a BOOL type might be 33 MB and a char type will use 266 MB. I can use all these different types instead but still there is not enough stack.. should i change compiler instead?

Thank you
0 Kudos
Message 3 of 4
(4,650 Views)
Unless your PC has significantly more RAM than 1GB, with a correspondingly-sized swap file, you are not going to be able to do this. Even if you do (and I'd suggest using memory off the heap, e.g. by using malloc()), you will most probably find that your application runs very slowly.

You would be wise to think of some way of partitioning the data so you don't have to have nearly so much in RAM at one time.
--
Martin
Certified CVI Developer
0 Kudos
Message 4 of 4
(4,650 Views)