Stack/Heap Collision (insufficient stack size)
#1

Hello there crashdetect plugin print this code into server_log,

Code:
[18:54:31] [debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[18:54:31] [debug]  Stack pointer (STK) is 0x434C28, heap pointer (HEA) is 0x434DB4
I was just wondering will this in example reduce stack size

This:
pawn Code:
stock funtion1(playerid){
    new mystr[64];
    format(mystr, sizeof(mystr), "Example %d", 1);
}

stock funtion2(playerid){
    new mystr[64];
    format(mystr, sizeof(mystr), "Example %d", 2);
}

stock funtion3(playerid){
    new mystr[64];
    format(mystr, sizeof(mystr), "Example %d", 3);
}
change to this:

pawn Code:
new mystr[MAX_PLAYERS][128];

stock funtion1(playerid){
    format(mystr[playerid], 64, "Example %d", 1);
}

stock funtion2(playerid){
    format(mystr[playerid], 64, "Example %d", 2);
}

stock funtion3(playerid){
    format(mystr[playerid], 64, "Example %d", 3);
}
I guess you all understand what I what to say... Is this good way to start optimizing script?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)