variablesmemorystackscilabexceed

SciLab - Stack size exceeded


So, I have this project for school in which I have to write code in SciLab to solve a puzzle (Tents). The code is getting longer and longer as it gets better and better, but I suddenly got an error stating "stack size exceeded".

Error log:
!--error 17 
stack size exceeded!
Use stacksize function to increase it.
Memory used for variables: 28875
Intermediate memory needed: 59987764
Total memory available: 10000000

I tried using this line

stacksize('max')

And this one

stacksize(1e8)

Neither of which works, all that happens is SciLab shutting itself down without any warning at all.

How did I exceed my stacksize? Is there a way to prevent this? How can I continue further?


Solution

  • I figured out myself how to solve this problem. Here's what I did wrong for people with the same problem:

    Within a function I used the line

    [m,n] = [x,y]
    

    to save the coordinates of an object from a matrix. This was called within a loop using x and y to browse through the matrix.

    Apparently this caused the stacksize exceeded error and here's how I wrote it afterwards:

    m = x
    n = y
    

    I have no idea why this line caused this error, but this is how I've solved it.