Fixing arduino uno code so the message not enough memory dose not show

Hello all you coding geniuses, I have a problem.

i need help fixing my code so the message not enough memory.
my sketch is Currently using "323% of dynamic memory" or "6618 bytes of 2048 bytes"

heres my code

----------------------------------------------alarmclock_2.0.ino----------------------------------------------
#include <SPI.h>

//Add the SdFat Libraries
#include <SdFat.h>
#include <SdFatUtil.h>

//and the MP3 Shield Library
#include <SFEMP3Shield.h>

#include "RTClib.h"

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

//---------------------------------------------------------------------

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 20, 4);

SdFat sd;

RTC_DS3231 rtc;

SFEMP3Shield MP3player;

//---------------------------------------------------------------------

int lr = A3; //left red led
int lg = 5; //left green led
int lb = 3; //left blue led

int rr = A2; //right red led
int rg = A1; //right green led
int rb = A0; //right blue led

int lyb = 4; //left yellow button
int ryb = 10; //right yellow button

int sec;

char daysOfTheWeek[7][3] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};

String bdayList[100][9] = {{"4","14","1997","6","0","bday.mp3"},{"7","20","1982","6","0","bday.mp3"}};

SdFile bday_txt;

void left_LED(int r, int g, int b){
analogWrite(lr, r);
analogWrite(lg, g);
analogWrite(lb, b);
}

void right_LED(int r, int g, int b){
analogWrite(rr, r);
analogWrite(rg, g);
analogWrite(rb, b);
}

void displayTime(){
DateTime now = rtc.now();

lcd.setCursor(0, 1);
lcd.print("(");
lcd.print(daysOfTheWeek[now.dayOfTheWeek()]);
lcd.print(") ");
lcd.print(now.month(), DEC);
lcd.print('/');
lcd.print(now.day(), DEC);
lcd.print('/');
lcd.print(now.year(), DEC);

lcd.setCursor(0, 2);
lcd.print(now.hour(), DEC);
lcd.print(':');
lcd.print(now.minute(), DEC);
lcd.print(':');
lcd.print(now.second(), DEC);
lcd.println();
}

int ageCal(int CurrentYear, int BirthYear){
return CurrentYear - BirthYear;
}

void displayContact(String bday[100][9], int index, int age){
DateTime now = rtc.now();

lcd.setCursor(0, 3);
lcd.print(bday[index][6]);
lcd.print("-age:");
if(bday[index][7] == "boy"){
lcd.print(age);
}else{
lcd.print("???");
}

lcd.setCursor(0, 0);
lcd.print(bday[index][8]);
}

void readbday_txtFile(String bday[100][9]){
if (!bday_txt.open("bday.txt", O_READ)) {
sd.errorHalt("opening bday.txt failed");
}
//read bday.txt ex: 4,14,1997,6,0,bday.mp3
char letter;
String set;
String bday_txt_split[6];
int line = 0;
int index = 0;
while ((letter == bday_txt.read()) >= 0) {
if(letter == ","){
bday_txt_split[index] = set;
set = "";
}else if(letter == ";"){
for(int i = 0; i < 6; i++){
bday[line][i] = bday_txt_split[i];
}
set = "";
index = 0;
line++;
}else{
set += letter;
}
}
bday_txt.close();
}

void isBdayToday(String bday[100][9]){
DateTime now = rtc.now();

for(int i=0;i<100;i++){
if(bday[i][0] == now.month() and bday[i][1] == now.day() and bday[i][3] == now.hour() and bday[i][4] == now.minute()){
uint32_t offset = 2000;
char trackName[12];
bday[i][5].toCharArray(trackName, 12);

  int age = ageCal(now.year(), bday[i][2].toInt());
  displayContact(bday,i,age);
  
  #if USE_MULTIPLE_CARDS
    sd.chvol(); // assign desired sdcard's volume.
  #endif
  //tell the MP3 Shield to play that file
  uint8_t result = MP3player.playMP3(trackName, offset);
  //check result, see readme for error codes.
  if(result != 0) {
    for(int i=0; i < 5; i++){
    left_LED(255,0,0);
    delay(1000);
    left_LED(0,0,0);
    delay(1000);
    right_LED(255,0,0);
    delay(1000);
    right_LED(0,0,0);
    delay(1000);
    }
    Serial.print(F("Error code: "));
    Serial.print(result);
    Serial.println(F(" when trying to play track"));
  }else{
    left_LED(0,255,0);
    right_LED(0,255,0);
  }
  while(MP3player.isPlaying()){
    if(digitalRead(lyb) == HIGH or digitalRead(ryb) == HIGH){
      break;
    }
  }
}else{
  lcd.setCursor(0, 3);
  lcd.print("--------------------");
  lcd.setCursor(0, 0);
  lcd.print("--------------------");
}

}
}

void setup () {

pinMode(lr, OUTPUT);
pinMode(lg, OUTPUT);
pinMode(lb, OUTPUT);

pinMode(rr, OUTPUT);
pinMode(rg, OUTPUT);
pinMode(rb, OUTPUT);

pinMode(lyb, INPUT);
pinMode(ryb, INPUT);

Serial.begin(57600);

//#ifndef ESP8266
// while (!Serial); // wait for serial port to connect. Needed for native USB
//#endif

if (! rtc.begin()) {
Serial.println("Couldn't find RTC");
Serial.flush();
abort();
}

if (rtc.lostPower()) {
left_LED(0,0,255);
right_LED(0,0,255);
Serial.println("RTC lost power, let's set the time!");
// When time needs to be set on a new device, or after a power loss, the
// following line sets the RTC to the date & time this sketch was compiled
rtc.adjust(DateTime(F(DATE), F(TIME)));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
}

// When time needs to be re-set on a previously configured device, the
// following line sets the RTC to the date & time this sketch was compiled
// rtc.adjust(DateTime(F(DATE), F(TIME)));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));

displayTime();
}

void loop() {
DateTime now = rtc.now();

sec = now.second();

if(now.second() > sec){
displayTime();
}
readbday_txtFile(bdayList);
isBdayToday(bdayList);
}
---------------------------------------end----alarmclock_2.0.ino----end----------------------------------
Please help me fix my code.

You’re reserving 100x9 bytes on every function call - as well as the original array declaration…

If you declare the array as needed - once, then pass pointers or just the indices, that will help a lot.

don’t know what the string library does to RAM, but I suspect it isn’t good.
C-strings might be a safer way to approach this reject on a tiny processor.

also, this is quite RAM intensive:

#include <SdFat.h>

and you have some further RAM saving opportunities with the F macro, e.g.:

Serial.println("RTC lost power, let's set the time!");

How much over the storage limit(s) is this sketch ?

Thanks man that helped a lot.

An empty String consumes six bytes of RAM, so that's 5400 bytes of RAM of your 2048 bytes right there, even before you've put any data in

Please remember to use code tags when posting code

Make sure you plug the Arduino directly into the computer and not through a hub. Using a hub will give you this error.

@trombetta220 - are you sure you're replying to the right post?