[HELP] stack undeflow runtime error 7
#1

Hello everyone. So last night I just added few objects in my gamemode and I compile it enter the server everything worked fine and today I run samp-server.exe console oke no error by crashdetect and I enter in gamemode I mean connect and I get that stack underflow but last night I enter on server normall without any trouble or problems or errors runtime.

This is few places I mean publics where crachdetect is discover that stack underflow

pawn Код:
[21:15:39] [debug] AMX backtrace:
[21:15:39] [debug] #0 ???????? in public JailTimerUpdate ()
[21:15:40] [debug] Run time error 7: "Stack underflow"
[21:15:40] [debug]  Stack pointer (STK) is 0x22293A8, stack top (STP) is 0x222939C
and here is that public

pawn Код:
forward JailTimerUpdate();
public JailTimerUpdate()
{
    foreach(Player,i)
    {
        if(IgracLogiran[i] == 1)
        {
            if(PlayerInfo[i][Zatvoren] != 0)
            {
                PlayerInfo[i][ZatvorenVrijeme]--;
                new string[64];
                format(string,sizeof(string),"%d",PlayerInfo[i][ZatvorenVrijeme]);
                TextDrawSetString(ZatvorenDraw1[i],string);
                TextDrawShowForPlayer(i,ZatvorenDraw0[i]);
                TextDrawShowForPlayer(i,ZatvorenDraw1[i]);
            }
            else
            {
                TextDrawHideForPlayer(i,ZatvorenDraw0[i]);
                TextDrawDestroy(ZatvorenDraw0[i]);
                TextDrawHideForPlayer(i,ZatvorenDraw1[i]);
                TextDrawDestroy(ZatvorenDraw1[i]);
            }
        }
    }
    return 1;
}
I don't know what might happens I last night normaly connected to server and exit and I close samp-server.exe and this morning I get those stack underflow

also here it is what it says when I compile gamemode without any errors or warnings:

pawn Код:
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase

Header size:          18364 bytes
Code size:          4784448 bytes
Data size:         18781088 bytes
Stack/heap size:   17039360 bytes; estimated max. usage: unknown, due to recursion
Total requirements:40623260 bytes
Reply
#2

anyone? thanks
Reply
#3

Hello!

Add this under the includes:
PHP код:
#pragma dynamic 1000000 
If the message in the compiler does not disappear, increase the number.

Mencent
Reply
#4

That is not a solution, that's a workaround. Reduce the size of your strings where possible. For example, in the small snippet you posted I see this:
pawn Код:
new string[64];
                format(string,sizeof(string),"%d",PlayerInfo[i][ZatvorenVrijeme]);
The longest a number can ever get is 11 characters. Add one null terminator and we get a string with a size of 12. A reduction of over 80%.
Reply
#5

I found the problem it was the new streamer which I updated Streamer Plugin v2.7.5.2 and when I back to streamer 2.7.4 everything works fine know.
Reply
#6

Vince how can I count for example characters and put that the same into new string[] like

pawn Код:
new str1[1024];
        format(str1,sizeof str1,"| WAR Start | %s is run a war with: [%s] [%s],in minutes[%d min],Location: %s",ime,timtext11,timtext22,WarTrajanje,ImeMape);
        AdminPoruka(COLOR_ZUTA,str1);
I apologize here for double posting I forgot to edit my previous post. Thanks
Reply
#7

In such cases you cannot and you will have to make an educated guess, but 1024 is probably still way too big. The entire string without placeholders is just 67 characters long. I expect the string placeholders to be filled with a player, a gang name and a location, neither of which should realistically exceed 100 characters. So you can cut that size in half to begin with.

I don't know what "AdminPoruka" is, but please also note that the maximum output length for SendClientMessage is 144 characters.
Reply
#8

So I maybe have in gamemode the string size which maybe is too big but it doesn't so how can I count for example this

format(string,sizeof(string),"Hello everyone"); so do I count for new string[size]

Hello everyone is 13 characters so the new string should be new string[13] or new string[14] if you know what I mean? Thanks
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)