SA-MP Forums Archive
unknown, due to recursion - 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: unknown, due to recursion (/showthread.php?tid=204111)



unknown, due to recursion - Mean - 28.12.2010

What does this mean
Код:
Stack/heap size:      16384 bytes; estimated max. usage: unknown, due to recursion
It should show how many cells I use, but it doesn't. It says unknown due to recursion. What does it mean ?


Re: unknown, due to recursion - Mean - 29.12.2010

Bump -.- .


Re: unknown, due to recursion - Scenario - 29.12.2010

I believe when something like that shows on the compiler that it means your string sizes are too large. So when you have things like:
pawn Код:
new string[500];
for something like
pawn Код:
format(string, sizeof(string), "Welcome, %s(%d)", pName, playerid);
then you really don't need such a large string size. Make sense?


Re: unknown, due to recursion - Mauzen - 29.12.2010

This is an example for recursion:

pawn Код:
Recursion(number)
{
    new next_number = number + 1;
    Recursion(next_number);
}

// Will be executed like this
Recursion(number)
{
    new next_number = number + 1;
    {
        new next_number_2 = next_number + 1;
        {
            new next_number_3 = next_number_2 + 1;
            {
                //...
            }
        }
    }
}
As you see, the function calls itself - in this case for ever. So the compiler does not know, how much ram this will need, as there are new variables in every call, and the old ones do not get deleted.
Recursions itself are a nice scripting method, as long as you use them correctly and end them at some point. So the compiler message does not have to be bad.

Check your script for a function that calls itself, and you got the reason for that message.


Re: unknown, due to recursion - Mean - 29.12.2010

All my strings are lower than 128, so I need to optimize my GM actually ?


Re: unknown, due to recursion - Infamous - 29.12.2010

Take a look at this thread: Code Optimization