2

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?

Joe Pineda
  • 5,521
  • 3
  • 31
  • 40
Krikke93
  • 219
  • 1
  • 3
  • 12
  • Which platform do you use (win/linux 32/64)? What size of RAM do you have? The command `stacksize('max')` shuts SciLab instantly, or the calculation done after the command? – Peter Petrik Apr 03 '14 at 07:50
  • I use win 64 with 8GB of RAM. Scilab shuts down instantly when I run the program. Sorry for the late respond btw, hope you'll still notice this :) – Krikke93 Apr 09 '14 at 11:55
  • Does `stacksize('max')` command in clean file coredumps Scilab? – Peter Petrik Apr 09 '14 at 12:07
  • First, I like the "The code is getting longer and longer as it gets better and better" quote. That aside, could you provide your code? Is there any recursion in there, or a big amount of for-loops? Probably you'll have to refactor your code, to calculate everything step-by-step and not all in one go. But this will be easier to see if you give the code or a description of the problem/your solution. – spoorcc Apr 09 '14 at 13:28

1 Answers1

1

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.

Krikke93
  • 219
  • 1
  • 3
  • 12