MAX STRING problem
#1

Hello I uses a string[2048] and I get this message...This is new script so there not much strings

Header size: 9632 bytes
Code size: 567004 bytes
Data size: 18101904 bytes
Stack/heap size: 16384 bytes; estimated max. usage: unknown, due to recursion
Total requirements:18694924 bytes

This message is bad? can make my server bug? if its not bad..any way aviod this message?
Reply
#2

Quote:
Originally Posted by Kenway
View Post
Hello I uses a string[2048]
Why?

Quote:
Originally Posted by Kenway
View Post
This message is bad? can make my server bug?
Yes. You're using more memory than is assigned which will eventually result in stack corruption.
Reply
#3

Well i use a query that saves the data...but why when i put a string in another mode its dont show the message
Reply
#4

For huge strings, just put them in the main script, outside any function or callback to make it a global string.

That way, it doesn't use the stack (just regular memory) and you won't get that message.
And you won't risk stack corruption.

The thing I would be worried about it, the recursion message.
This indicates there are functions calling themselves again and if you're not careful with such things, you might get infinite loops, which will crash your server.
pawn Code:
Player_AddExperience(playerid, Experience)
{
    APlayerData[playerid][Experience] = APlayerData[playerid][Experience] + Experience;
    if (APlayerData[playerid][Experience] >= MaxExperience)
    {
        APlayerData[playerid][Level]++;
        APlayerData[playerid][Experience] = Player_AddExperience(playerid, -MaxExperience);
    }
}
This is an example of a function that calls itself, and could cause infinite loops in certain conditions if your code isn't carefully written.
Reply
#5

well i have some loops but i always close them i have like 10-15 loops like this:
Code:
for(new d = 0; d < 12; d++)
{
        //code.....
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)