Stack/heap collision (insufficient stack size)
#1

Code:
[16:18:19]bind 89.22.96.43 [debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[16:18:19]bind 89.22.96.43 [debug]   Stack index (STK) is 0x21B4F4, heap index (HEA) is 0x21EE48
[16:18:19]bind 89.22.96.43 [debug] AMX backtrace:
[16:18:19]bind 89.22.96.43 [debug] #0  00000008 in ?? () at C:\Users\Timothy\Desktop\SAN ANDREAS\pirates\pawno\include\float.inc:102
TBH, my script really is big, but the stack/heap size is only 290 cells.

Code:
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

Header size:          11376 bytes
Code size:           796056 bytes
Data size:          2207024 bytes
Stack/heap size:      16384 bytes; estimated max. usage=290 cells (1160 bytes)
Total requirements: 3030840 bytes
Once I am trying to add one more mysql threaded query, I get this error somehow. What should I do?
Reply
#2

@******

I am not using a lot of local variables, the thing is that my server requires a lot of global and especially enum variables. Apart from that I am using a lot of includes, so that could explain the big size aswell.
Anyway, I used #pragma dynamic and assigned 5000 as a value to it.
I got the error @ 15kbs as heap size, with 5000 assigned as pragma it's now 19kbs.
Reply
#3

Did you accidentally make an infinite loop somewhere? If the loops doesn't stop and a variable is declared in the loop the stack just piles up trying to allocate all the memory and stack/heap will collide at some point.
Reply
#4

Global variables are not stored on the stack. Also it's not about a lot of local variables, it's about big local variables. Something like new array[2048] could already exceed the stack size.
Reply
#5

Well I am not using such big variables. The biggest variable I have is 83 cells and everything else is 2 or 3 cells.
Except for some strings ofcourse, but they are no longer than 128, I have thought a lot about the sizes of the strings I created. Some are 22 for example.
Reply
#6

maybe you have *uh I forgot what this is called, maybe someone can tell me*

Example you have something like this where the stack is built up in more than one function

pawn Code:
public StackStart()
{
    new array[1024];
    Stack1();
    return 1;
}

public Stack1()
{
    new array[1024];
    Stack2();
    return 1;
}

public Stack2()
{
    new array[512];
    Stack3();
    /*OPTIONAL: somewhere in this function could fail to execute and the stack wouldn't be cleared*/
    return 1;
}

public Stack3()
{
    new array[2048];
    //here in the final callback, it exceeds the stack
    return 1;
}
This is just a typical example, don't kill me >.<
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)