Run time error 3 : Stack/heap collision (insufficient stack size)
#1

Hi.

I compiled a gamemode and tried to launch it but it simply don't launch because of the error quoted above.
I read that it's a problem with ressources and optimization, but I can't optimize more my code (1500 lines, it's just a base) and I tried to run the gamemode on my computer : 4Go of RAM, quadcore 2.6GHz Intel CPU and 512Mb VRAM AMD GPU.

What could be wrong ?

Error code : http://pastebin.com/MQ3wB9kV

Thanks in advance.
Reply
#2

Are you getting the code info message while compiling? I don't even know how that'd be possible with just 1500 lines.
Reply
#3

So, I just get the final compilator message :

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

[Finished in 12.9s]
And I was wrong : it's not 1500 but 1100.
It's true that I was surprised : compiling only 1'000 lines takes almost 13 seconds, whereas I compiled a code which was almost five times the size of this code and it took less time.
Reply
#4

I tried making more "global" variables, they are smaller as I can, and I don't think I call more function than usual, but still the same error log remaining : http://pastebin.com/13JFpmUv

If you see what's wrong in my code : http://pastebin.com/3C1wg8wx

Thanks in advance, because I really don't see.
Reply
#5

Quote:
Originally Posted by S4t3K
View Post
I tried making more "global" variables, they are smaller as I can, and I don't think I call more function than usual, but still the same error log remaining : http://pastebin.com/13JFpmUv

If you see what's wrong in my code : http://pastebin.com/3C1wg8wx

Thanks in advance, because I really don't see.
Can you please compile with -d3? It gives you more information where the problem occurs, check on how to compile with debug level 3
https://github.com/Zeex/samp-plugin-...ith-debug-info
Reply
#6

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

Header size:           4548 bytes
Code size:           461052 bytes
Data size:           573000 bytes
Stack/heap size:      16384 bytes; estimated max. usage: unknown, due to recursion
Total requirements: 1054984 bytes
Reply
#7

Anyone ?
Reply
#8

Well, it shows me the real reason for the crash with the debug mode, thanks to both of ****** and Patrick_ : the problem came from the printfEx function. I explain myself : I created a function called printEx, but I realized that it's a bit useless because printf does exactly the same thing but with a console-display message. So I used CTRL + H to replace all the statement "print" by "printf", but it also renames the function and the pre-processor definition, so the compiler compiled fine but with an erroned function.

For the interested persons, the function implementation and his pre-processor definition are here (still in the pastebin I've shown before)

PHP Code:

#define printf printfEx

stock printfEx(const string[], va_args<>)
{
    static 
out[512];
    
va_format(outstrlen(string), stringva_start<1>);
    return 
printf(out);

I deleted both of this and, moreover of the fact that it compiles faster, the server launched successfuly.
Thanks again.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)