estimated max. usage: unknown, due to recursion
#1

Header size: 10432 bytes
Code size: 1084596 bytes
Data size: 21742740 bytes
Stack/heap size: 16384 bytes; estimated max. usage: unknown, due to recursion
Total requirements:22854152 bytes

I got this when I complied, could anyone explain me what does it mean?

it happened after I placed the next command:
PHP код:
CMD:dice(playerid,params[]){
LoggedCMD
if(!IsPlayerInRangeOfPoint(playerid,2,214.6529,1828.4265,2001.0857)) return MSG(playerid,C_RED,"[Error] {ff9999}You're not in the right place to use this command.");
if(
sscanf(params,"sd",MiniString,param[0])) return MSG(playerid,C_RED,"[Error] {FF9999}/Dice [1-6/Even/Odd] [Amount]");
if(
param[0]>DB[playerid][Money] || param[0]<1) return MSG(playerid,C_RED,"[Error] {Ff9999}Invalid Amount.");
if(
strcmp(MiniString,"1",true) && strcmp(MiniString,"2",true) && strcmp(MiniString,"3",true) && strcmp(MiniString,"4",true) && strcmp(MiniString,"5",true) && strcmp(MiniString,"6",true) && strcmp(MiniString,"Even",true) && strcmp(MiniString,"Odd",true)) return MSG(playerid,C_RED,"[Error] {ff9999]/Dice [1-6/Even/Odd]");
new 
PlayerBet[MAX_PLAYERS],DiceResult[MAX_PLAYERS],bool:WonX2[MAX_PLAYERS],bool:WonX6[MAX_PLAYERS];
if(!
strcmp(MiniString,"1",true)){PlayerBet[playerid] = 1;}
if(!
strcmp(MiniString,"2",true)){PlayerBet[playerid] = 2;}
if(!
strcmp(MiniString,"3",true)){PlayerBet[playerid] = 3;}
if(!
strcmp(MiniString,"4",true)){PlayerBet[playerid] = 4;}
if(!
strcmp(MiniString,"5",true)){PlayerBet[playerid] = 5;}
if(!
strcmp(MiniString,"6",true)){PlayerBet[playerid] = 6;}
if(!
strcmp(MiniString,"Even",true)){PlayerBet[playerid] = 7;}
if(!
strcmp(MiniString,"Odd",true)){PlayerBet[playerid] = 8;}
new 
rand random(2);
switch(
rand){
case 
0DiceResult[playerid] = 1;
case 
1DiceResult[playerid] = 2;
case 
2DiceResult[playerid] = 3;
case 
3DiceResult[playerid] = 4;
case 
4DiceResult[playerid] = 5;
case 
5DiceResult[playerid] = 6;
case 
6DiceResult[playerid] = 7;
case 
7DiceResult[playerid] = 8;}
if(
PlayerBet[playerid] == && DiceResult[playerid] == 1){WonX6[playerid] = true;} else{WonX6[playerid] = false;}
if(
PlayerBet[playerid] == && DiceResult[playerid] == 2){WonX6[playerid] = true;} else{WonX6[playerid] = false;}
if(
PlayerBet[playerid] == && DiceResult[playerid] == 3){WonX6[playerid] = true;} else{WonX6[playerid] = false;}
if(
PlayerBet[playerid] == && DiceResult[playerid] == 4){WonX6[playerid] = true;} else{WonX6[playerid] = false;}
if(
PlayerBet[playerid] == && DiceResult[playerid] == 5){WonX6[playerid] = true;} else{WonX6[playerid] = false;}
if(
PlayerBet[playerid] == && DiceResult[playerid] == 6){WonX6[playerid] = true;} else{WonX6[playerid] = false;}
if(
PlayerBet[playerid] == && DiceResult[playerid] == || DiceResult[playerid] == || DiceResult[playerid] == 6){WonX2[playerid] = true;} else{WonX2[playerid] = false;}
if(
PlayerBet[playerid] == && DiceResult[playerid] == || DiceResult[playerid] == || DiceResult[playerid] == 5){WonX2[playerid] = true;} else{WonX2[playerid] = false;}
if(
WonX2[playerid] && !WonX6[playerid]){
format(SString,sizeof(SString),"[Casino] {00FF00}YOU WON $%s!",Comma(param[0]*2));
MSG(playerid,C_GOLD,SString);
DB[playerid][Money]=DB[playerid][Money]+param[0];
WonX2[playerid] = false;
WonX6[playerid] = false;}
if(!
WonX2[playerid] && WonX6[playerid]){
format(SString,sizeof(SString),"[Casino] {00FF00}YOU WON $%s!",Comma(param[0]*6));
MSG(playerid,C_GOLD,SString);
DB[playerid][Money]=DB[playerid][Money]+param[0]*5;
WonX2[playerid] = false;
WonX6[playerid] = false;}
if(!
WonX2[playerid] && !WonX6[playerid]){
format(SString,sizeof(SString),"[Casino] {FF0000}You didn't win this this time.",Comma(param[0]*6));
MSG(playerid,C_GOLD,SString);
DB[playerid][Money]=DB[playerid][Money]+param[0]*5;
WonX2[playerid] = false;
WonX6[playerid] = false;}
if(
WonX2[playerid] && WonX6[playerid]){
MSG(playerid,C_GOLD,"[Casino] {FF0000}If you see this message contact the admins as soon as possible.");
WonX2[playerid] = false;
WonX6[playerid] = false;
return 
1;} 
Reply
#2

Think u will not understand what I say in english, but: that means that u have tooo much size used.
Like: string[500]; everywhere. too much variables with huge size.
U can also set
Код:
#pragma dynamic 3000
or more, if needed.
(Hope someone else will say for u normally, but maybe u understand somethink )

and u dont need to use ministring there. u have params[] by default from DC_CMD/ZCMD or what u have. just put params[0],params[1],params[2] and etc if u want that.
Reply
#3

This may not have anything to do with it, but haven't you noticed how extremely repetitive your code is?

PHP код:
switch(rand){
case 
0DiceResult[playerid] = 1;
case 
1DiceResult[playerid] = 2;
case 
2DiceResult[playerid] = 3;
case 
3DiceResult[playerid] = 4;
case 
4DiceResult[playerid] = 5;
case 
5DiceResult[playerid] = 6;
case 
6DiceResult[playerid] = 7;
case 
7DiceResult[playerid] = 8;} 
versus
PHP код:
DiceResult[playerid] = rand 1
and
PHP код:
if(PlayerBet[playerid] == && DiceResult[playerid] == 1){WonX6[playerid] = true;} else{WonX6[playerid] = false;}
if(
PlayerBet[playerid] == && DiceResult[playerid] == 2){WonX6[playerid] = true;} else{WonX6[playerid] = false;}
if(
PlayerBet[playerid] == && DiceResult[playerid] == 3){WonX6[playerid] = true;} else{WonX6[playerid] = false;}
if(
PlayerBet[playerid] == && DiceResult[playerid] == 4){WonX6[playerid] = true;} else{WonX6[playerid] = false;}
if(
PlayerBet[playerid] == && DiceResult[playerid] == 5){WonX6[playerid] = true;} else{WonX6[playerid] = false;}
if(
PlayerBet[playerid] == && DiceResult[playerid] == 6){WonX6[playerid] = true;} else{WonX6[playerid] = false;} 
versus
PHP код:
WonX6[playerid] = (PlayerBet[playerid] == DiceResult[playerid]); 
Reply
#4

Your code looks terrible!

"estimated max. usage: unknown, due to recursion"

The warning is no problem at all.

Just means the Compiler cannot tell what the max. size of the heap/stack is because some code runs in recursion.
Recursion means if a function calls itself, all containing variables are initialized again, however the Compiler does not know how often this happens because it's decided run-time.

I don't see a recursion in your code though. Is MiniString global?
Reply
#5

Quote:
Originally Posted by NaS
Посмотреть сообщение
Your code looks terrible!

"estimated max. usage: unknown, due to recursion"

The warning is no problem at all.

Just means the Compiler cannot tell what the max. size of the heap/stack is because some code runs in recursion.
Recursion means if a function calls itself, all containing variables are initialized again, however the Compiler does not know how often this happens because it's decided run-time.

I don't see a recursion in your code though. Is MiniString global?
MiniString appears on the top of the script.
I changed the WHOLE fucking code now and deleted the strings from the top of the script and moved them into the functions itself with approximate bytes size of the string but sadly I think it's even worse. What would be better? to put it up there or create the "new String[X]" again and again?
Reply
#6

As I said, it's not a problem that it shows that message when compiling unless your script doesn't run at all.

However you should put "new MiniString[X];" into your command (and other functions/callbacks where you use it). It will make it a tiny bit faster and it's commonly done that way.
Reply
#7

Quote:
Originally Posted by NaS
Посмотреть сообщение
Your code looks terrible!

"estimated max. usage: unknown, due to recursion"

The warning is no problem at all.

Just means the Compiler cannot tell what the max. size of the heap/stack is because some code runs in recursion.
Recursion means if a function calls itself, all containing variables are initialized again, however the Compiler does not know how often this happens because it's decided run-time.

I don't see a recursion in your code though. Is MiniString global?
Quote:
Originally Posted by NaS
Посмотреть сообщение
As I said, it's not a problem that it shows that message when compiling unless your script doesn't run at all.

However you should put "new MiniString[X];" into your command (and other functions/callbacks where you use it). It will make it a tiny bit faster and it's commonly done that way.
You earned your rep!
btw I tried to expand it by 10000 by now it shows it again xD how much should I expand?
Reply
#8

Quote:
Originally Posted by Lirbo
Посмотреть сообщение
You earned your rep!
btw I tried to expand it by 10000 by now it shows it again xD how much should I expand?
What do you mean? Are you talking about "#pragma dynamic" I took out of my reply?
If yes, you don't need to, it doesn't have anything to do with it. I was mixing it up with another compiler warning :/

If you have big ass local arrays somewhere (4096 slots or more, which is the default heap/stack size) you should use dynamic to extend the stack/heap, otherwise it's pointless.
Reply
#9

Quote:
Originally Posted by Vince
Посмотреть сообщение
PHP код:
WonX6[playerid] = (PlayerBet[playerid] == DiceResult[playerid]); 
Stealing the thread for my own education.

What's the difference in writing this?
PHP код:
WonX6[playerid] = (PlayerBet[playerid] == DiceResult[playerid]) ? (true) : (false); 
Reply
#10

Both do the same thing but using parenthesis makes it a statement that can be only true or false. Ternary operator in that case is not needed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)