PDA

View Full Version : MAX STRING problem


Kenway
30/01/2015, 10:57 AM
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?

Vince
30/01/2015, 11:08 AM
Hello I uses a string[2048]
Why?

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.

Kenway
30/01/2015, 11:11 AM
Well i use a query that saves the data...but why when i put a string in another mode its dont show the message

PowerPC603
30/01/2015, 11:21 AM
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.

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.

Kenway
30/01/2015, 11:26 AM
well i have some loops but i always close them i have like 10-15 loops like this:

for(new d = 0; d < 12; d++)
{
//code.....
}