SA-MP Forums Archive
Error compile. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Error compile. (/showthread.php?tid=422744)



Error compile. - audriuxxx - 15.03.2013

Hi,

Код:
Header size:          19432 bytes
Code size:          3302720 bytes
Data size:         21626308 bytes
Stack/heap size:      16384 bytes; estimated max. usage=5177 cells (20708 bytes)
Total requirements:24964844 bytes
How to fix that?


Re: Error compile. - Vince - 15.03.2013

If you compiled your script with debug flags (-d3) or verbose information (-v) then that message will show up. If you don't have either of these set then it means that your script uses too much resources and that you should reduce the size of your local variables.


Re: Error compile. - LarzI - 15.03.2013

https://sampforum.blast.hk/showthread.php?tid=55261


Re: Error compile. - Ballu Miaa - 15.03.2013

Quote:
Originally Posted by LarzI
Посмотреть сообщение
This is what you need. Use this thread. Cheers LarzI. Rep+4

You need to reduce cell size where ever required within your game mode. Remember where it is required.

Example:

Lets consider you have this code.
pawn Код:
public OnPlayerConnect(playerid)
{
     new str[256],name[MAX_PLAYER_NAME+1];
     GetPlayerName(playerid, name, sizeof(name));
     format(str,sizeof(str),"Hello %s , Welcome to SA-MP Server." , name);
     SendClientMessage(playerid, -1, str);
     return 1;
}
In the above example the actual size required is: 58 (MAX_PLAYER_NAME+1 + String used in str = 25 + 33)

The corrected code should be:

pawn Код:
public OnPlayerConnect(playerid)
{
     new str[59],name[MAX_PLAYER_NAME+1]; // You can put 60 also. Not a big deal. But having 256 utilises lot of memory and it is too slow.
     GetPlayerName(playerid, name, sizeof(name));
     format(str,sizeof(str),"Hello %s , Welcome to SA-MP Server." , name);
     SendClientMessage(playerid, -1, str);
     return 1;
}



Re: Error compile. - audriuxxx - 15.03.2013

But it's only string sizes?


Re: Error compile. - audriuxxx - 15.03.2013

And does it hurt script, if this warning is?


Re: Error compile. - LarzI - 15.03.2013

Strings are declared just like arrays, so more precisely it's how much memory you use in variables, ESPECIALLY arrays as they require a lot of memory if they have a lot of cell-data.


Re: Error compile. - Vince - 15.03.2013

Quote:
Originally Posted by audriuxxx
Посмотреть сообщение
And does it hurt script, if this warning is?
Eventually you will get a stack/heap collision which results in corruption of data due to variables being overwritten.


Re: Error compile. - Konstantinos - 15.03.2013

I wanted to create a thread which is related to this information, but since there's already one I'll reply here.

In 0.3e, I had that pawn.cfg file to "pawno\" directory and I could see this kind of information (Header size, Code size, Data size, Stack/heap size, Total requirements), but when I switched to 0.3x even if I have that file, it doesn't show anything. Does anybody know why? I'd appreciate it!


Re: Error compile. - LarzI - 15.03.2013

Quote:
Originally Posted by Dwane
Посмотреть сообщение
I wanted to create a thread which is related to this information, but since there's already one I'll reply here.

In 0.3e, I had that pawn.cfg file to "pawno\" directory and I could see this kind of information (Header size, Code size, Data size, Stack/heap size, Total requirements), but when I switched to 0.3x even if I have that file, it doesn't show anything. Does anybody know why? I'd appreciate it!
No clue at all. I switched and my -d3 compile option works just as intended and as before. Try re-installing (re-downloading) the server package and manually delete and make a new pawn.cfg with the options you want/need.