Arduino Memory FULL, I don't know why

Hey, I have been recently working on a project to make a serial monitor based User Interface, I have also tried to make some graphic designs using ascii character BUT there is this strange Memory problem, it says 70% of your dynamic memory is full, I don't understand how to fix it, I am trying to use variables with proper data types. Can you please help me?. Here is the complete code:

#include "PROFILE.h"
Profile USER; 
byte DisplayCount;
void setup(){
  Serial.begin(115200);
}


void loop(){
  byte Var = Serial.read();
  if(Var == 'o'){                                 //This is how you call the User interface by sending 'o'
    USERProfile();
  }

   if(Var == 'h'){
      USER.Display(6); 
     }

  delay(20);
}


void wait(){
  while(Serial.available() == 0){
    
  }
}


void filter(){

  for(byte i = 1; Serial.available() >= i;){
    Serial.read();
    delay(7);
  }
}

class Profile {
 public: 
  char INFO[15];
  char Username[15] = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
  char Password[15] = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
  byte LIMIT;
  byte storeIndex = 0;
  byte storeIndex2 = 0;  
  
  byte i = 0; 
  byte N = 0;
  byte P = 1;
  byte S = 0; 
  byte SerialSTRlen; 
  
  String Name; 
  String Pass;
  String NameInfo[6] = {"0", "0", "0", "0", "0"};
  String PassInfo[6] = {"0", "0", "0", "0", "0"};
  String USERDATA[2];
  byte c = 0; 
  String Ques[5]; 
  
  void filter(){  
                                              //Filters out the serial buffer
  for(int i = 1; Serial.available() >= i; ){
    Serial.read();
    delay(30);
  }
}

  int wait(){                                          //Hangs the control loop at specific point in code 
  while(Serial.available() == 0){
  delay(4);
  
  } 

} 
  

  String StoreInfo(byte g, char a){
    char Temp; 

  
    delay(30);
    
    storeIndex = Serial.available(); 
    for(int i = 0; i < storeIndex; i++){

       
        Temp = Serial.read();
        if(a == 'U'){
          Username[i] = Temp;
        }

        if(a == 'P'){
          Password[i] = Temp;
        }
        
        if(i == 0){
          USERDATA[g] = Temp;
        }

        if(i > 0){
          USERDATA[g] = USERDATA[g] + Temp;
        }
         delay(4);
         
     }
     
   SerialSTRlen = storeIndex; 
   storeIndex = 0;
   return USERDATA[g]; 
  }
  


  int REGISTER(){

   if(true){
     NameInfo[i]  =  USERDATA[0]; 
     PassInfo[i]  = USERDATA[1]; 
        
      if(i < 6){

        if((USERDATA[0] == NameInfo[i]) && (USERDATA[1] == PassInfo[i])){
           i++;
           return true;
        }
        
        else{
          return false; 
        }     
      }
    }
}
  
  int VERIFY(){
    byte P = 0; 
    

    for(byte j = 0; j <= 6; j++){
      if((USERDATA[0] == NameInfo[j]) and (USERDATA[1] == PassInfo[j])){

         P = 1;
         return true; 
      }
     
   
    }

  if(P < 1){

    return false; 
  }
   
  }

  byte VERIFY2(byte r){ 
      if(r == 1){                                                  //Directly calling this function VERIFY() ISN'T WORKING SO, Had to put it in another function inside this class
       VERIFY();                                                    // And then call this function to call the first function
   }
  }

 
  int Display(int a){

      for(int i = 0; i < a; i++){
        Serial.print("  [[Account Name]] " + NameInfo[i] + "  ");
        Serial.println( "  [[Account Password]] " + PassInfo[i]);
      }
  }


  byte SystemScan(){

       bool RG = REGISTER();
       bool VR = VERIFY();

       if((RG == false) || (VR == false)){
         if(RG == false){
          Serial.println();
          Serial.println("       ๏ผฅ๏ผฒ๏ผฒ๏ผฏ๏ผฒ ๏ผ(๐˜š๐˜บ๐˜ด๐˜ต๐˜ฆ๐˜ฎ ๐˜Œ๐˜ณ๐˜ณ๐˜ฐ๐˜ณ) ๐‘…๐‘’๐‘”๐‘–๐‘ ๐‘ก๐‘Ÿ๐‘Ž๐‘ก๐‘–๐‘œ๐‘› ๐น๐‘Ž๐‘–๐‘™๐‘’๐‘‘!   โœ• โœ•");
         }

         if(VR == false){
          Serial.println();
          Serial.println("      ๏ผฅ๏ผฒ๏ผฒ๏ผฏ๏ผฒ ๏ผ(๐˜š๐˜บ๐˜ด๐˜ต๐˜ฆ๐˜ฎ ๐˜Œ๐˜ณ๐˜ณ๐˜ฐ๐˜ณ) ๐ถ๐‘Ž๐‘›๐‘›๐‘œ๐‘ก ๐‘‰๐‘’๐‘Ÿ๐‘–๐‘“๐‘ฆ!   โœ• โœ•");
         }
       }

      if((RG == false) && (VR == false)){
        Serial.println(" ");
        Serial.println(" ๐Ÿ’€ ๐—ฆ๐˜†๐˜€๐˜๐—ฒ๐—บ ๐—™๐—ฎ๐—ถ๐—น๐˜‚๐—ฟ๐—ฒ ๐Ÿ’€ !!");
      }
       else{
        Serial.println();
        Serial.println("  ");
        Serial.println("  โŒ ๐™๐™ฃ๐™ ๐™ฃ๐™ค๐™ฌ๐™ฃ ๐™€๐™ง๐™ง๐™ค๐™ง ๐™ค๐™˜๐™˜๐™ช๐™ง๐™š๐™™ โŒ ");
       }
  }



  byte ForgotInfo(byte a){
    
       for(int i = 0; i < a; i++){

           if(USERDATA[0] == NameInfo[i]){
              return 'n';
           }

           if(USERDATA[1] == PassInfo[i]){
              return 'p';  
           }
       }  
  }

  byte SETQues(byte IN, String ANS){

       Ques[IN] = ANS; 
    
  }

 byte DataLocation(String Name, String Pass, byte a, bool Setcodepcs){                  //Gives the index number of the data stored in array 
      byte TP; 
 
       if(Setcodepcs == true){

          for(byte t = 0; t < 6; t++){
             if((Name == NameInfo[t]) and (Pass == PassInfo[t])){
                return t; 
                TP++;
             }
            }

         if(TP == 0){
          return 100;
         }
           }
           
      
      
      

      if(Setcodepcs == false){
       
         for(byte g = 0; g < 6; g++){
           if((Name == NameInfo[g]) or (Pass == PassInfo[g])){
              TP++; 
              return g; 
           }
         }
      
       if(TP == 0){
        return 100;
       }
      }
}


 byte StringLength(bool y){
 byte strcount = 0;  
 
 if(y == true){                                 
    
    for(byte i = 0; i == i; i++){                            //This code right here gives the number of characters in a string value, it doesn't include the strings with spaces eg ' '. 
    
      if(Username[i] != ' '){  
          strcount++; 
          
         if(Username[i+1] == ' '){
          
            for(byte w = i+1; w < 16; w++){               //This for loop removes character spaces from getting counted 
              
              if(Username[w] != ' '){
               strcount++;
              }
            }
            return strcount; 
           }
         
        
         }
       }
      
    } 
    
    
 if(y == false){

    for(byte i = 0; i == i; i++){
      if(Password[i] != ' '){
        strcount++;
        if(Password[i+1] == ' '){

          for(byte d = i + 1; d < 16; d++){
            if(Password[d] != ' '){
              strcount++; 
            }
          }
          return strcount; 
        }
      }
     
    }
    
  }

 }
byte ParseData2(byte STR){                                             //Capital letter  detection.
  byte Inc = 0; 
for(byte i = 0; i <= STR; i++){
 
   if((Password[i] >= 'A') && (Password[i] <= 'Z')){
       for(byte h = 0; h < 16; h++){
            Password[h] = ' '; 
            Username[h] = ' ';
       }
    
        Inc++;
        return true; 
       
       }
  
   
    }
  
  if(Inc == 0){
    for(byte k = 0; k < 16; k++){
      Password[k] = ' ';    
    }
    
    return false;
  }
 }


byte RemoveChar(byte a){
  byte STR2; 
  for(byte i = 0; i < 16; i++){
    if(Username[i] == ' '){

      for(byte u = i; u < 16; u++){
        
        if(Username[u] != ' '){
          STR2 = u;
          for(byte g = i; g < 16; g++){
            
            Username[g] = Username[STR2];
            Username[STR2] = ' ';
            STR2++;
            
            if(Username[g] == ' '){
              goto PT2;
            }
          }
        }
      }
    }
   PT2:;
  }
 
  for(byte w = 0; w <= SerialSTRlen; w++){                              //Here the variable SerialSTRlen is storing the value of the length of a string, which has already been counted and
    if(w < 1){                                                        // stored in this variable, we're using this value here to not assign anything extra in array causing any problems or bugs
      USERDATA[a] = Username[w];
      continue;                                                       //                                             [[!!SENSITIVE PART OF CODE!!]]
    }
    
    USERDATA[a] = USERDATA[a] + Username[w]; 
    
  }
}

byte VERIFY3(byte x ){
 byte HU; 
  for(byte i = 0; i < 6; i++){
    if((USERDATA[x] == NameInfo[i]) or (USERDATA[x] == PassInfo[i])){
      HU++;
      return true; 
    }
  }

  if(HU == 0){
    return false; 
  }

  
}


};

Here is the main function called UserInterface() that actually runs the UI


int USERProfile(){                                          //This is the home page it's a individual functions which uses PROFILE.h class's functions as building blocks of UI
 

 if(DisplayCount > 0){
       Serial.println();
       Serial.println();
       Serial.println();
       Serial.println();
       Serial.println();      
 }
 DisplayCount++;                                                                                       
Serial.println("          `7MMF'  `7MMF'                                                                          ");
Serial.println("            MM      MM                                                                            ");
Serial.println("            MM      MM  ,pW'Wq.`7MMpMMMb.pMMMb.  .gP'Ya      `7MMpdMAo.  ,6'Yb.  .P`Ybmmm .gP'Ya  ");
Serial.println("            MMmmmmmmMM 6W'   `Wb MM    MM    MM ,M'   Yb       MM   `Wb 8)   MM :MI  I8  ,M'   Yb ");
Serial.println("            MM      MM 8M     M8 MM    MM    MM 8M''''''       MM    M8  ,pm9MM  WmmmP'  8M'''''' ");
Serial.println("            MM      MM YA.   ,A9 MM    MM    MM YM.    ,       MM   ,AP 8M   MM 8M       YM.    , ");
Serial.println("          .JMML.  .JMML.`Ybmd9'.JMML  JMML  JMML.`Mbmmd'       MMbmmd'  `Moo9^Yo.YMMMMMb  `Mbmmd'"); 
Serial.println("                                                               MM               6'     dP     ");    
Serial.println("                                                             .JMML.             Ybmmmd'    ");
Serial.println();
Serial.println();
Serial.println("          ๐™ก๐™ค๐™œ ๐™„๐™‰(i)                ๐˜พ๐™ง๐™š๐™–๐™ฉ๐™š ๐˜ผ๐™˜๐™˜๐™ค๐™ช๐™ฃ๐™ฉ(c)              ๐™Ž๐™š๐™ฉ๐™ฉ๐™ž๐™ฃ๐™œ๐™จ(s)");                       
Serial.println();
Serial.println();
Serial.println("                                                                                            New User? -> Sฬฒiฬฒgฬฒnฬฒ UฬฒPฬฒ ");
Serial.println();
Serial.println("                                                                              Already have an account? -> lฬฒoฬฒgฬฒ IฬฒNฬฒ ");
Serial.println();
Serial.println("                                           [[INTRODUCTION]] ");
Serial.println();
Serial.println("   WELCOME, This is a LED based Snake game. You can explore several game modes and can enjoy");
Serial.println("   the game with your friends and family through our Multiplayer game features ");
Serial.println("   We've been implementing tons of game features of make the gameplay enjoyable");
Serial.println("   Since, this game is still under development phase, only registered users can play the game ");
Serial.println("   PLEASE Sign UP if you're new user ");

USER.filter();




wait();
char Select = Serial.read(); 

if(Select == 'i'){
   LOGIN(0, 0);
}

if(Select == 'c'){
   REGISTRATION();
}

if(Select == 's'){

   Settings();
}




    
}


byte LOGIN(byte X, byte T){                             //This function takes input from the user and verifies if the info is correct
  byte pass; 
  byte LostInfo; 
  bool alpha = true; 
  R_EnterP:
  Serial.println();
  Serial.println();
  Serial.println("         Eฬฒnฬฒtฬฒeฬฒrฬฒ Uฬฒsฬฒeฬฒrฬฒnฬฒaฬฒmฬฒeฬฒ       ");
  USER.filter();
  wait();
  
 
  delay(20);
  USER.StoreInfo(USER.N, 'U');
  USER.filter();
  if(alpha == false){
    goto VRFY;
  }


  R_EnterN:
  Serial.println();
  Serial.println("         Eฬฒnฬฒtฬฒeฬฒrฬฒ Pฬฒaฬฒsฬฒsฬฒwฬฒoฬฒrฬฒdฬฒ       ");
  Serial.println();
  wait();
  delay(20);
  USER.StoreInfo(USER.P, 'U');

  VRFY:
  delay(20);
  bool B = USER.VERIFY();
 while(true) { 
  if(B == true){
    Serial.println("         Verifying Account.......");
    delay(800);
    Serial.print("         STATUS :");
    Serial.println(" ๐˜š๐˜ถ๐˜ค๐˜ค๐˜ฆ๐˜ด๐˜ด๐˜ง๐˜ถ๐˜ญ โœ” ");
    Serial.println();
    Serial.println("         ๐™‹๐™ง๐™š๐™จ๐™จ(๐™ฅ) ๐™›๐™ค๐™ง ๐˜ผ๐™˜๐™˜๐™ค๐™ช๐™ฃ๐™ฉ ๐˜ฟ๐™š๐™ฉ๐™–๐™ž๐™ก๐™จ ๐™ค๐™ง ๐™ฅ๐™ง๐™š๐™จ๐™จ ๐™–๐™ฃ๐™ฎ ๐™ ๐™š๐™ฎ ๐™ฉ๐™ค ๐™€๐™“๐™„๐™");
    USER.filter();
    wait();
    char UD = Serial.read(); 
    if(UD == 'p'){
       Serial.println();
       Serial.print("               ๐”๐ฌ๐ž๐ซ๐ง๐š๐ฆ๐ž ๐ˆ๐ƒ              ๐๐š๐ฌ๐ฌ๐ฐ๐จ๐ซ๐ ");
       Serial.println();
       Serial.print(" ๐—”๐—ฐ๐—ฐ ๐——๐—ฒ๐˜๐—ฎ๐—ถ๐—น๐˜€ -          " + USER.NameInfo[USER.i - 1] + "           " +  USER.PassInfo[USER.i - 1]);
       Serial.println();
       Serial.println();
       Serial.println();
       Serial.println();
       Serial.println();
    }

    else if(UD != 'p'){
      Serial.println();
      Serial.println();
      Serial.println("    ๐Ÿšช ๐„๐ฑ๐ข๐ญ๐ž๐ ๐Ÿšช  ");
    }
  }

  if(B == false){
     Serial.print("         Verifying Account.......");
     Serial.println("         ๐‘ป๐’‰๐’† ๐‘จ๐’„๐’„๐’๐’–๐’๐’• ๐’…๐’๐’†๐’” ๐’๐’๐’• ๐’†๐’™๐’Š๐’”๐’•๐’” ");
     delay(800);
     Serial.print("         STATUS :");
     Serial.print(" ๐˜œ๐˜ฏ๐˜ด๐˜ถ๐˜ค๐˜ค๐˜ฆ๐˜ด๐˜ด๐˜ง๐˜ถ๐˜ญ โŒ    "); 

     char FI = USER.ForgotInfo(6);
        
         if(FI == 'n'){                                                            //These are the options when user has forgotten details and needs to recover
            Serial.println("               Re-Enter(r) or Forgot Password(f) ? ");
         }
    
         else if(FI == 'p'){
            Serial.println("               Re-Enter(r) or Forgot Username(f) ? ");
         }
       
         OPT1:
         filter();
         wait();
         char RA = Serial.read();
         if(RA == 'f'){

            if((FI == 'n') || (FI == 'p')){

                RECOVERY(6);
                break;
            }
           
           }

         if(RA == 'r'){
           if(FI == 'n'){
             goto R_EnterN; 
           }

           else if(FI == 'p'){
             alpha = false; 
             goto R_EnterP; 
           }
         }
        
        else{
          goto OPT1; 
        }
      }
     break; 
   }   
}



byte REGISTRATION(){                                                                        //This is the registration page which registers the new user
String TMPdata = " ";

while(true){
filter();
//Serial.println("     ___                            _    ______           _     _             _   _             ");
//Serial.println("    / _ \                          | |   | ___ \         (_)   | |           | | (_)            ");
//Serial.println("   / /_\ \ ___ ___ ___  _   _ _ __ | |_  | |_/ /___  __ _ _ ___| |_ _ __ __ _| |_ _  ___  _ __  ");
//Serial.println("   |  _  |/ __/ __/ _ \| | | | '_ \| __| |    // _ \/ _` | / __| __| '__/ _` | __| |/ _ \| '_ \ ");
//Serial.println("   | | | | (_| (_| (_) | |_| | | | | |_  | |\ \  __/ (_| | \__ \ |_| | | (_| | |_| | (_) | | | |");
//Serial.println("   \_| |_/\___\___\___/ \__,_|_| |_|\__| \_| \_\___|\__, |_|___/\__|_|  \__,_|\__|_|\___/|_| |_|");
//Serial.println("                                                     __/ |                                      ");
//Serial.println("                                                    |___/                                       ");
Serial.println("  ๐‘ท๐’๐’†๐’‚๐’”๐’† ๐’†๐’๐’•๐’†๐’“ ๐’•๐’‰๐’† ๐’‡๐’๐’๐’๐’๐’˜๐’Š๐’๐’ˆ ๐’“๐’†๐’’๐’–๐’Š๐’“๐’†๐’… ๐’…๐’†๐’•๐’‚๐’Š๐’๐’”                                CANCEL(c)"); 

Serial.println();
Serial.println();
Serial.println("                NOTE:- Username and Password must not exceed more than 12 characters");

USN: 
Serial.println();
Serial.print("              `-:๐”๐’๐„๐‘๐๐€๐Œ๐„:-`  " + TMPdata);

filter();
wait();


delay(30);
USER.StoreInfo(0, 'U'); 
filter();


byte str1 = USER.StringLength(true);
bool userName = USER.ParseData2(str1);
//USER.RemoveChar(0);

byte Cnt = 0; 
PASS:;
Serial.print("        `-:๐๐€๐’๐’๐–๐Ž๐‘๐ƒ:-`      Must include atleast one Upper case letter in your password");
Serial.println();
Serial.println();
filter();
wait();
USER.StoreInfo(1, 'P');


byte str2 = USER.StringLength(false);
bool UpperCase2 = USER.ParseData2(str2);


//***************************************************************************************************//
if( ((str1 > 12) || (str2 > 12)) or ((str1 > 12) && (str2 > 12))){

  for(byte q = 0; q <= 3; q++){
    Serial.println();
  }

  if((str1 > 12) and (str2 < 12)){
    char Input; 
   
    Serial.println();
    Serial.print("              `-:๐”๐’๐„๐‘๐๐€๐Œ๐„:-`    Username length has exceeded 12 character limit ");
    Serial.println();
    
    Serial.println(" Cancel Registration(c) OR  Proceed(p) to change Username ");

    POINT3:
    filter();
    wait();
    delay(20);
    
    Input = Serial.read();
    if(Input == 'p'){
       goto USN;
    }

    if(Input == 'c'){
      goto END;
    }

    else{
      goto POINT3;
    }
  }

 else if((str2 > 12) and (str1 < 12)){
    
    char Input; 
   
    Serial.println();
    Serial.print("        `-:๐๐€๐’๐’๐–๐Ž๐‘๐ƒ:-`  Password has exceeded 12 character limit!");
    Serial.println();
    
    Serial.println(" Cancel Registration(c) OR  Proceed(p) to change PASSWORD ");

    POINT1:
    filter();
    wait();

    Input = Serial.read();
    if(Input == 'p'){
       goto PASS;
    }

    if(Input == 'c'){
      goto END;
    }

    else{
      goto POINT1;
    }
  }

 else{
  Serial.println();
  Serial.println();
  Serial.println("  โŒโŒ Either Username or Password has exceeded 12 Character LIMIT โŒโŒ!! ");
  Serial.println();
  Serial.println(" Cancel Registration(c) OR Proceed(p) to change details ");

  POINT2:
  filter();
  wait();

  char Input = Serial.read();

  if(Input == 'p'){
    goto USN;
  }

  if(Input == 'c'){
    goto END;
  }

  else{
    goto POINT2; 
  }
 }
   
}
//*************************************************************************************************//


if(UpperCase2 == false){
  Serial.print("        !!INCLUDE ATLEAST ONE UPPERCASE LETTER!!  ");
  Serial.println();
  Serial.println();
  Serial.println();
  Cnt++;
  goto PASS; 
}

if(Cnt > 0){
  Serial.println("  Details have been verified ");
}


bool CHK = USER.VERIFY(); 
                                                                                                                                                 
if(CHK == true){
  Serial.println(" Account Already exists !!");
  break; 
  
}


  USER.REGISTER();


      bool k = USER.VERIFY();
      if(k == true){
      
      Serial.print("  ๐—”๐—ฐ๐—ฐ ๐——๐—ฒ๐˜๐—ฎ๐—ถ๐—น๐˜€ - "); 
      Serial.print("  " + USER.NameInfo[USER.i-1]);
      Serial.println("                   " + USER.PassInfo[USER.i-1]);
      
      }

    if(k == false){                                               //This code here checks if anything went wrong while registering if something does it initializes diagnostics to inspect
      Serial.println(" ");                                       // Problem, it checks several code blocks and function and returns values representing functioning of code. 
      Serial.print("       ๐ˆ๐ง๐ข๐ญ๐ข๐š๐ฅ๐ข๐ณ๐ข๐ง๐  ๐ƒ๐ข๐š๐ ๐ง๐จ๐ฌ๐ญ๐ข๐œ๐ฌ...");
      delay(1000);
      Serial.print("..");
      delay(700);
      Serial.print(".....");
      delay(750);
      Serial.println("..");
      USER.SystemScan();
}

break;
}
filter();
END: 
                        ; 
}

byte RECOVERY(byte a){
Serial.println();
Serial.println("          [[  ACCOUNT RECOVERY ]]) ");
Serial.println();
Serial.println();
Serial.println("        Pฬฒrฬฒoฬฒvฬฒiฬฒdฬฒeฬฒ uฬฒsฬฒ aฬฒnฬฒyฬฒ Aฬฒcฬฒcฬฒ Iฬฒnฬฒfฬฒoฬฒ tฬฒhฬฒaฬฒtฬฒ yฬฒoฬฒuฬฒ aฬฒrฬฒeฬฒ aฬฒbฬฒlฬฒeฬฒ tฬฒoฬฒ rฬฒeฬฒmฬฒeฬฒmฬฒbฬฒeฬฒrฬฒ :- ");
Serial.println();
Serial.println("   ๐—™๐—ผ๐—ฟ๐—ด๐—ผ๐˜ ๐—ฃ๐—ฎ๐˜€๐˜€๐˜„๐—ผ๐—ฟ๐—ฑ(๐—ฝ) โ“                  ๐—™๐—ผ๐—ฟ๐—ด๐—ผ๐˜ ๐—จ๐˜€๐—ฒ๐—ฟ๐—ป๐—ฎ๐—บ๐—ฒ(๐—ป) โ“ ");  

OPT3:
filter();
wait();

char INFO = Serial.read();  
  if(INFO == 'p'){
    Serial.println();
    Serial.println("        ๐—˜๐—ป๐˜๐—ฒ๐—ฟ ๐—จ๐˜€๐—ฒ๐—ฟ๐—ป๐—ฎ๐—บ๐—ฒ ");
    Serial.println();
    filter();
    wait();

    delay(20);
    USER.StoreInfo(0, 'U');

    delay(10);
    byte indx = USER.DataLocation(USER.USERDATA[0], USER.USERDATA[0], 6, false);
    Serial.println(indx);
    Serial.println("       Enter the Security code ");

    filter();
    wait();

    String D = USER.StoreInfo(0, 'U');
    byte rand = 0; 

   
    for(byte i = 0; i < 6; i++){
      if(D == USER.Ques[i]){
        
        j:
         Serial.println(" Enter new password");
         filter();
         wait();
        
         delay(20);
         String Tem = USER.StoreInfo(1, 'P');
         USER.PassInfo[indx] = Tem; 

         byte st = USER.StringLength(false);
         bool GH = USER.ParseData2(st); 

         if(((GH == false) || (st > 12))){

          if((GH == false) && (st < 12)){
            Serial.println(); 
            Serial.println();
            Serial.println(" Must include atleast one Upper case letter ");
            
            goto j;
          }

          if((GH == true) && (st > 12)){
            Serial.println();
            Serial.println();
            Serial.println(" Your PASSWORD length has exceeded the 12 Character LIMIT ");

            goto j;
          }

          else{
            Serial.println();
            Serial.println(" Your either password doesn't fullfill the criterion ");
            goto j;
          }
         }

        USER.Display(6); 
         
        rand++;   
      }
    }
    if(rand == 0){
     Serial.println(" Security question does not exists ");
   }
   
  }
  
  else if(INFO == 'n'){

      ENTPASS:
      Serial.println();
      Serial.println();
      Serial.println("  Enter Password ");
      filter();
      wait();

      delay(20);
      String Response1 = USER.StoreInfo(1, 'P');
      String BufferResp1 = Response1; 
      byte locate = USER.DataLocation(USER.USERDATA[0], USER.USERDATA[1], 6, false);
      byte Free = 0; 
      
      for(byte u = 0; u < 6; u++){
        
        if(Response1 == USER.PassInfo[u]){
           Free++;
           Serial.println();
           Serial.println("   Enter the Security CODE/Question, if not so then please consider doing it for your recovery ");
           Serial.println();
           filter();
           wait();

           delay(20);
           Response1 = USER.StoreInfo(1, 'P');

           for(byte w = 0; w < 6; w++){
             if(Response1 == USER.Ques[w]){
                Free++;
                User:
                Serial.println();
                Serial.println("     Enter NEW Username ");
                Serial.println();
                filter();
                wait();

                delay(20);
                ////////////////////////////////////////////////////////////////////
                USER.NameInfo[locate] = USER.StoreInfo(0, 'U'); /* CODE FOR STORING THE NEW USERNAME, OR REPLACING THE OLD ONE */
                //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

                bool Recheck = USER.VERIFY();
                byte WE = USER.StringLength(true); 
                bool UPLWcase = USER.ParseData2(WE);

                if(Recheck == true){
                  Serial.println();
                  Serial.println(" This password has already been Selected, take the other name or press exit(e) to leave ");

                  filter();
                  wait();
                
                  delay(20);
                  if(Serial.read() == 'e'){
                    Serial.println(" EXITED");
                    break; 
                  }

              
         
                }

                if((WE > 12)){
                   Serial.println();
                   Serial.println("   Can't you just type NoRmaLly??  you just literally mistyped something wrong, DUMB! ");
                   Serial.println("  Now press(p) to enter again or just press exit(e) to get out ");

                   Range:
                   filter();
                   wait();

                   char AGR = Serial.read();

                   if(AGR == 'p'){
                      goto User;
                   }

                   else if(AGR == 'e'){
                     break; 
                   }

                   else{
                    goto Range; 
                   }

                   
                }

              
         
                Serial.println();
                Serial.println("      PRESS(p) for Account details or PRESS(e) to Exit ");
                Serial.println();
                filter();
                wait();

                double TemVar = Serial.read();

                if(TemVar == 'p'){

                  Serial.print("    Username"); Serial.println("      Password ");
                  Serial.println(" ACC details :- " + USER.NameInfo[locate] + "        " + USER.PassInfo[locate]);
                  goto END;
                }

                else if(TemVar == 'e'){
                  Serial.println("                  [EXITED] ");
                  break; 
                }
               
             }

             
           }

         
        }
      }


     switch(Free){
       case 1:
        Serial.println();
        Serial.println(" security code doesn't exist ");
        break;
       
       case 0:
        Serial.println();
        Serial.println(" Password is not correct !");
        goto ENTPASS;
        break;
     }
     
  }

else{
  goto OPT3;
}

  END:;
}


void Settings(){
Serial.println();
Serial.println("   [[ Settings ]]");
Serial.println();
Serial.println();

Serial.println(" Enter USERNAME");

filter();
wait();

delay(20);

USER.StoreInfo(0, 'U');


Serial.println(" Enter Password ");
filter();
wait();

delay(20);
USER.StoreInfo(1, 'U');

bool IN = USER.VERIFY();

byte inNO = USER.DataLocation(USER.USERDATA[0], USER.USERDATA[1], 6, true );



if(IN == true){

  Serial.println(" Choose a security code ");

  filter();
  wait();

  String tempData = USER.StoreInfo(0, 'U');

  USER.SETQues(inNO, tempData);

  Serial.println(USER.Ques[inNO]);
  Serial.println(inNO);
}


else if(IN == false){

  Serial.println(" The details submitted are wrong or the account does not exist");
}


}

What does the compiler say? Looking at the code it does seem a bit large...

I could be wrong, but check variables that are declared in global scope or as class member variables. These will exist for the lifetime of the program or the class object (if that itself is declared and instantiated in global scope).

Also check the String arrays NameInfo, etc. Do you really need arrays for this? String will take up some minimum memory because its a dynamic type. Instead why not use an array of char* (or char[][]) instead. You can limit each char[] to say, 10.

Use the F macro:

Serial.print( F(" STATUS :") ) ;

In such cases to stop the strings using RAM [dynamic memory]

Which Arduino board are you using?

Your post was MOVED to its current location as it is more suitable.

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

In file included from C:\Users\1597471\Documents\Arduino\Arduino_Application\Arduino_Application.ino:1:0:
C:\Users\1597471\Documents\Arduino\Arduino_Application\USER_interface.ino: In member function 'Profile::ParseData2(unsigned char)':
C:\Users\1597471\Documents\Arduino\Arduino_Application\PROFILE.h:277:25: warning: iteration 15 invokes undefined behavior [-Waggressive-loop-optimizations]
             Password[h] = ' ';
             ~~~~~~~~~~~~^~~~~
C:\Users\1597471\Documents\Arduino\Arduino_Application\PROFILE.h:276:26: note: within this loop
        for(byte h = 0; h < 16; h++){
                        ~~^~~~
C:\Users\1597471\Documents\Arduino\Arduino_Application\PROFILE.h:291:19: warning: iteration 15 invokes undefined behavior [-Waggressive-loop-optimizations]
       Password[k] = ' ';
       ~~~~~~~~~~~~^~~~~
C:\Users\1597471\Documents\Arduino\Arduino_Application\PROFILE.h:290:23: note: within this loop
     for(byte k = 0; k < 16; k++){
                     ~~^~~~
C:\Users\1597471\Documents\Arduino\Arduino_Application\PROFILE.h: In function 'ParseData2.constprop':
C:\Users\1597471\Documents\Arduino\Arduino_Application\PROFILE.h:291:19: warning: iteration 15 invokes undefined behavior [-Waggressive-loop-optimizations]
       Password[k] = ' ';
                   ^
C:\Users\1597471\Documents\Arduino\Arduino_Application\PROFILE.h:290:23: note: within this loop
     for(byte k = 0; k < 16; k++){
                       ^
C:\Users\1597471\Documents\Arduino\Arduino_Application\PROFILE.h:277:25: warning: iteration 15 invokes undefined behavior [-Waggressive-loop-optimizations]
             Password[h] = ' ';
                         ^
C:\Users\1597471\Documents\Arduino\Arduino_Application\PROFILE.h:276:26: note: within this loop
        for(byte h = 0; h < 16; h++){
                          ^
Sketch uses 14480 bytes (5%) of program storage space. Maximum is 253952 bytes.
Global variables use 6005 bytes (73%) of dynamic memory, leaving 2187 bytes for local variables. Maximum is 8192 bytes.

This is what the code says it compiles succesfully but memory is the problem even I am using the Arduino Mega

Sorry, I am very new to this forum and I don't know how to find good topics to post my questions, I really appreciate your suggestion

@rohitbd

I actually did instantiate the class object as USER no constructor, and yes there's pretty much a lot of use for the arrays so if I explain my system what it does it basically stores the user data in those two arrays, And limiting those will mean that User can't type enough characters to make a strong password when the user wants to.

You declare Password as follows:

char Password[15] ...

which allows for 15 bytes (0..14 inclusive) but you have loops like this:

for(byte k = 0; k < 16; k++){
      Password[k] = ' ';

which try to write 16 values to it (0 thru 15 inclusive) so you're going to be stomping.

Go through every such warning and note and ensure you correct all instances of writing outside the bounds of an array like this.

@Blackfin

Hey, I am trying but I don't know what those errors mean honestly I tried searching it up but I wasn't able to understand it normally or in simple terms, what is dynamic memory anyway?

1 Like

Google for โ€œrandom access memory โ€œ
In this case it is working memory writable during the execution of your sketch. This is different from flash/ program memory which can only be read at that time.

Iโ€™ve edited post #3 to make it clearer for you.

1 Like

Hey thanks for the help, Now I know that there was a mismatch. But I am still at 73% memory full

What you want to achieve is very easy in the case of a normal computer where RAM and storage is usually not the concern of the program - that is handled by the OS. Things like memory swapping, paging etc make the hardware transparent to the program.

However we cannot have the same expectation from a microcontroller board. It has both limited RAM and storage (that too only for the program code, not data). The compiler will try to optimise the code, but then ultimately it is the physical resources that will be the limiting factor. Also there is no support for memory management like an OS (though there could be some mechanism - I'm not sure). So as far as possible minimise the no. of variables, use the right data type, minimise code size (no. of lines, no. of functions, etc) where possible - the whole program is stored in the flash when not in use and then loaded into RAM when it's running.

All said, the board's hardware will ultimately decide if it can be used for a particular application or not. System programming like controlling motors, other boards, etc are easily achievable. But for more advanced applications it might not be suitable.

Even when using the F() macro as instructed?

Your problem is the huge amount of Serial.print() with constant text. All this text is copied to RAM if you don't use the F() macro as already advised.

And you should switch on the warnings in 'preferences'.

P.S: You cannot use the F() macro when you use funtionality of the String class as in

      Serial.print("  " + USER.NameInfo[USER.i-1]);

But it's sufficent if you use the F() macro in all other cases ( e.g. compiled for a Nano ):

Sketch uses 14348 bytes (46%) of program storage space. Maximum is 30720 bytes.
Global variables use 1037 bytes (50%) of dynamic memory, leaving 1011 bytes for local variables. Maximum is 2048 bytes.

@6v6gt

Hey Thanks now my arduino memory is much lower it's now at 46%, Thanks everyone who helped me YOU GUYS literally saved me. I used F macro and it's perfect now. But I still don't understand how does F macro work?

@6v6gt

I have Arduino Mega 2560

@MicroBahner,

Hey thank you so much for your help it really works when I used F macro. I am very new to programming and I don't know much how does program affect RAM deeply all I understand is the Concept of data types which I know occupies a lot of memory if not used well

Hey, hi I know you from the last post when I asked about Serial read function. It's Nice to see you again.

The AVR architecture has two main address spaces, one for RAM, and one for flash memory.
The F macro ensures that strings don't get copied from flash to RAM by crt0.

@TheMemberFormerlyKnownAsAWOL

I also have another problem with my code, when I use the Remove char() function of class Profile it has some very unexpected and weird behavior, The remove char function removes all the white spaces from the string inputted by the USER for e.g "H E L L O" will Become "HELLO". it makes changes to the Array named as USERDATA which is also of class profile it keeps adding all characters to this array and then that array is further used to finally register and verify the details inputted by the User through Serial monitor

here is the code where I have problem


byte REGISTRATION(){                                                                        //This is the registration page which registers the new user
String TMPdata = " ";

while(true){
filter();
//Serial.println("     ___                            _    ______           _     _             _   _             ");
//Serial.println("    / _ \                          | |   | ___ \         (_)   | |           | | (_)            ");
//Serial.println("   / /_\ \ ___ ___ ___  _   _ _ __ | |_  | |_/ /___  __ _ _ ___| |_ _ __ __ _| |_ _  ___  _ __  ");
//Serial.println("   |  _  |/ __/ __/ _ \| | | | '_ \| __| |    // _ \/ _` | / __| __| '__/ _` | __| |/ _ \| '_ \ ");
//Serial.println("   | | | | (_| (_| (_) | |_| | | | | |_  | |\ \  __/ (_| | \__ \ |_| | | (_| | |_| | (_) | | | |");
//Serial.println("   \_| |_/\___\___\___/ \__,_|_| |_|\__| \_| \_\___|\__, |_|___/\__|_|  \__,_|\__|_|\___/|_| |_|");
//Serial.println("                                                     __/ |                                      ");
//Serial.println("                                                    |___/                                       ");
Serial.println("  ๐‘ท๐’๐’†๐’‚๐’”๐’† ๐’†๐’๐’•๐’†๐’“ ๐’•๐’‰๐’† ๐’‡๐’๐’๐’๐’๐’˜๐’Š๐’๐’ˆ ๐’“๐’†๐’’๐’–๐’Š๐’“๐’†๐’… ๐’…๐’†๐’•๐’‚๐’Š๐’๐’”                                CANCEL(c)"); 

Serial.println();
Serial.println();
Serial.println("                NOTE:- Username and Password must not exceed more than 12 characters");

USN: 
Serial.println();
Serial.print("              `-:๐”๐’๐„๐‘๐๐€๐Œ๐„:-`  " + TMPdata);

filter();
wait();


delay(30);
USER.StoreInfo(0, 'U'); 
filter();


byte str1 = USER.StringLength(true);
bool userName = USER.ParseData2(str1);
USER.RemoveChar(0);                             //(([PROBLEM HERE  GUYS, THIS FUNCTION}}}
    

  for(byte w = 0; w < USER.SerialSTRlen; w++){                              //Here the variabLE 
                                                                                                          //SerialSTRlen is storing the 
                                                                                                         //value of the length of a 
                                                                                                      //string, which has already been 
                                                                                                      //counted and
    if(w == 0){                                                        // stored in this variable, we're using this value here to not assign anything extra in array causing any problems or bugs
      USER.USERDATA[0] = USER.Username[w];
                                     
                                                                     //            [[!!SENSITIVE PART OF CODE!!]]
    }

    if(w > 0){
    USER.USERDATA[0] = USER.USERDATA[0] + USER.Username[w]; 
    }
    Serial.print(USER.USERDATA[0]);
  }

byte Cnt = 0; 
PASS:;
Serial.print("        `-:๐๐€๐’๐’๐–๐Ž๐‘๐ƒ:-`      Must include atleast one Upper case letter in your password");
Serial.println();
Serial.println();
filter();
wait();
USER.StoreInfo(1, 'P');


byte str2 = USER.StringLength(false);
bool UpperCase2 = USER.ParseData2(str2);


//***************************************************************************************************//
if( ((str1 > 12) || (str2 > 12)) or ((str1 > 12) && (str2 > 12))){

  for(byte q = 0; q <= 3; q++){
    Serial.println();
  }

  if((str1 > 12) and (str2 < 12)){
    char Input; 
   
    Serial.println();
    Serial.print(F("              `-:๐”๐’๐„๐‘๐๐€๐Œ๐„:-`    Username length has exceeded 12 character limit "));
    Serial.println();
    
    Serial.println(F(" Cancel Registration(c) OR  Proceed(p) to change Username "));

    POINT3:
    filter();
    wait();
    delay(20);
    
    Input = Serial.read();
    if(Input == 'p'){
       goto USN;
    }

    if(Input == 'c'){
      goto END;
    }

    else{
      goto POINT3;
    }
  }

 else if((str2 > 12) and (str1 < 12)){
    
    char Input; 
   
    Serial.println();
    Serial.print(F("        `-:๐๐€๐’๐’๐–๐Ž๐‘๐ƒ:-`  Password has exceeded 12 character limit!"));
    Serial.println();
    
    Serial.println(F(" Cancel Registration(c) OR  Proceed(p) to change PASSWORD "));

    POINT1:
    filter();
    wait();

    Input = Serial.read();
    if(Input == 'p'){
       goto PASS;
    }

    if(Input == 'c'){
      goto END;
    }

    else{
      goto POINT1;
    }
  }

 else{
  Serial.println();
  Serial.println();
  Serial.println(F("  โŒโŒ Either Username or Password has exceeded 12 Character LIMIT โŒโŒ!! "));
  Serial.println();
  Serial.println(F(" Cancel Registration(c) OR Proceed(p) to change details "));

  POINT2:
  filter();
  wait();

  char Input = Serial.read();

  if(Input == 'p'){
    goto USN;
  }

  if(Input == 'c'){
    goto END;
  }

  else{
    goto POINT2; 
  }
 }
   
}
//*************************************************************************************************//


if(UpperCase2 == false){
  Serial.print(F("        !!INCLUDE ATLEAST ONE UPPERCASE LETTER!!  "));
  Serial.println();
  Serial.println();
  Serial.println();
  Cnt++;
  goto PASS; 
}

if(Cnt > 0){
  Serial.println("  Details have been verified ");
}


bool CHK = USER.VERIFY(); 
                                                                                                                                                 
if(CHK == true){
  Serial.println(F(" Account Already exists !!"));
  break; 
  
}


  USER.REGISTER();


      bool k = USER.VERIFY();
      if(k == true){
      
      Serial.print("  ๐—”๐—ฐ๐—ฐ ๐——๐—ฒ๐˜๐—ฎ๐—ถ๐—น๐˜€ - "); 
      Serial.print("  " + USER.NameInfo[USER.i-1]);
      Serial.println("                   " + USER.PassInfo[USER.i-1]);
      
      }

    if(k == false){                                               //This code here checks if anything went wrong while registering if something does it initializes diagnostics to inspect
      Serial.println(" ");                                       // Problem, it checks several code blocks and function and returns values representing functioning of code. 
      Serial.print("       ๐ˆ๐ง๐ข๐ญ๐ข๐š๐ฅ๐ข๐ณ๐ข๐ง๐  ๐ƒ๐ข๐š๐ ๐ง๐จ๐ฌ๐ญ๐ข๐œ๐ฌ...");
      delay(1000);
      Serial.print("..");
      delay(700);
      Serial.print(".....");
      delay(750);
      Serial.println("..");
      USER.SystemScan();
}

break;
}
filter();
END: 
                        ; 
}