SA-MP Forums Archive
Compiler stuff - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Compiler stuff (/showthread.php?tid=273027)

Pages: 1 2


Compiler stuff - MP2 - 31.07.2011

Quote:
Originally Posted by compiler
Header size: 8736 bytes
Code size: 1422004 bytes
Data size: 1701048 bytes
Stack/heap size: 16384 bytes; estimated max. usage: unknown, due to recursion
Total requirements: 3148172 bytes
This has something to do with memory, right? Is it a problem if it says that, or is it more of a warning?


Re: Compiler stuff - linuxthefish - 31.07.2011

You just have a large script or big arrays, nothing to worry about.


AW: Re: Compiler stuff - Nero_3D - 31.07.2011

Quote:
Originally Posted by linuxthefish
Посмотреть сообщение
You just have a large script or big arrays, nothing to worry about.
That just wrong

It doesnt matter if the script is big

You should read that => Why you should not use 256


Re: AW: Re: Compiler stuff - MP2 - 31.07.2011

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
That just wrong

It doesnt matter if the script is big

You should read that => Why you should not use 256
I know about that. I use the minimum required.

Is it better to have a global string variable or have it local everytime it's needed?


Re: Compiler stuff - Calgon - 31.07.2011

A global string variable, based on my recent experience.


Re: Compiler stuff - MP2 - 31.07.2011

That's what I'm using. I just lowered about 10 global string variables from 1000~ to 1, and still got the error. I haven't added new variables since I didn't have the message so what's going on? Is it because I upgraded to R5? Can't really see how.


Re: Compiler stuff - dowster - 31.07.2011

It's not an error, since PAWN is an embedded language its to help programmers (not specifically samp people) to know if their hardware will be able to actually fit the program and run it. I had this too before when i was messing around with the pragma that limits the ram usage for the .amx and stuff like that. The pawn language guide has something thats related to this in it.


Re: Compiler stuff - Scenario - 31.07.2011

Quote:
Originally Posted by Calg00ne
Посмотреть сообщение
A global string variable, based on my recent experience.
Agreed.


AW: Compiler stuff - Nero_3D - 31.07.2011

The warning appears due recursion

Quote:

Stack/heap size: 16384 bytes; estimated max. usage: unknown, due to recursion

You got a function which call itself again and again

That code would be enough to get that message

pawn Код:
#include <a_samp>

main() {
    Stack();
}

Stack(count = 0) {
    new
        tmp[4_055] = "Hello World";
    #pragma unused tmp
    if(0 < (--count)) {
        Stack(count);
    }
}
in that case put the tmp outside (global) or use a local static variable


Re: Compiler stuff - MP2 - 31.07.2011

I'm pretty sure I haven't got a recurring function, because I added one line to my script then compiled, then that warning appeared when I compiled.

If I do have a recurring function, how do I fix it? My script is tens of thousands of lines long.


Re: Compiler stuff - MadeMan - 31.07.2011

This warning usually comes when you use big (or many) local strings created with new.


Re: Compiler stuff - MP2 - 31.07.2011

I've removed some global variables, and it's gone down a tiny bit to:


Header size: 8676 bytes
Code size: 1426852 bytes
Data size: 1683752 bytes
Stack/heap size: 16384 bytes; estimated max. usage: unknown, due to recursion
Total requirements: 3135664 bytes

How much more do I need to remove?


Re: Compiler stuff - MadeMan - 31.07.2011

Make some LOCAL strings smaller.


Re: Compiler stuff - MP2 - 31.07.2011

I don't have many local strings. I have about 10 global strings.

These are my main global strings:

new string[2000]; //Basic strings
new string2[128]; //other strings
new file[64]; //Files
new telestring[1753]; // Teleport dialog list
new itelestring[1900]; // Teleport dialog list
new querystring[1280]; // mySQL queries

I know some seem huge, but it's necessary.


AW: Compiler stuff - Nero_3D - 31.07.2011

global data is stored in the binary file (the amx)
=> global data cant create such a warning

pawn Код:
#define BUT_WONT_CASE_A_WARNING (cellmax)

stock I_WILL_TAKE_AGES_TO_COMPILE[BUT_WONT_CASE_A_WARNING];

#undef BUT_WONT_CASE_A_WARNING
local variables are dynamically allocated and are saved in the heap (starts at 0)

Than if the stack (starts at the top) and the heap collides*І this warning appears

*І stack and heap uses the same memory block *і
*і usually 4096 cells big minus the header and some tables
=> around 4000 cells should work fine without collision / warning


Re: Compiler stuff - MP2 - 31.07.2011

So how many local variables do I need to remove?


AW: Compiler stuff - Nero_3D - 31.07.2011

The count doesnt matter, the size does, just change all local variables bigger than 4000 to global ones


Re: Compiler stuff - MP2 - 01.08.2011

The biggest local variable I have is like 500, for mySQL results.


AW: Compiler stuff - Nero_3D - 01.08.2011

Than the last possible reason, you use the debug option for the compiler (-d2 or -d3)


Re: Compiler stuff - MP2 - 01.08.2011

Can you eleborate? What's -d3 and -d3?