SSD1306 OLED Allocation Failed

Hi,I'm beginner at Arduino.I trying to make some projects.but I get this error message on Adafruit SSD1306 library.I read something about this is because of low flash.But I can't reduce my variable,all necessary.Can you help me please?
Here is my code.


#include <virtuabotixRTC.h>    
#include <MPU6050_tockn.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// Example sketch for interfacing with the DS1302 timekeeping chip.
//
// Copyright (c) 2009, Matt Sparks
// All rights reserved.
//
// http://quadpoint.org/projects/arduino-ds1302
virtuabotixRTC myRTC(6, 7, 5);

#include <SPI.h>
#include <SD.h>

File myFile;


#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
// The pins for I2C are defined by the Wire-library. 
// On an arduino UNO:       A4(SDA), A5(SCL)
// On an arduino MEGA 2560: 20(SDA), 21(SCL)
// On an arduino LEONARDO:   2(SDA),  3(SCL), ...
#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(128, 64, &Wire, OLED_RESET);

MPU6050 mpu6050(Wire);


void setup() {
// seconds, minutes, hours, day of the week, day of the month, month, year

  display.begin();
Wire.begin();
  mpu6050.begin();
  mpu6050.calcGyroOffsets(true);
    if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Don't proceed, loop forever

  }
}

void loop() {
    mpu6050.update();

display.clearDisplay();
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
display.setCursor(0,0);
display.print("X:");
display.println(abs(mpu6050.getGyroX()));

display.setCursor(0,12);
display.print("Y:");
display.println(abs(mpu6050.getGyroY()));

display.setCursor(0,24);
display.print("Z:");
display.println(abs(mpu6050.getGyroZ()));

display.setCursor(0,36);
display.print("ORT:");
display.println((abs(mpu6050.getGyroX())+abs(mpu6050.getGyroY())+abs(mpu6050.getGyroZ()))/3);

  myRTC.updateTime();       
  display.setCursor(0,48);
  display.print(myRTC.hours);
  display.print(":");
  display.print(myRTC.minutes);
  display.print("   ");
  display.print(myRTC.dayofmonth);
    display.print("/");
  display.print(myRTC.month);
      display.print("/");
  display.print(myRTC.year);
display.display();

if((mpu6050.getGyroX()>0,7)||(mpu6050.getGyroY()>0,7)||(mpu6050.getGyroZ()>0,7))
{
myFile = SD.open("kayitlar.txt", FILE_WRITE);

  // if the file opened okay, write to it:
  if (myFile) {

    myFile.print(myRTC.hours);
    myFile.print(":");
    myFile.print(myRTC.minutes);
    myFile.print("  ");

    myFile.print(myRTC.dayofmonth);
    myFile.print("/");
    myFile.print(myRTC.month);
    myFile.print("/");
    myFile.print(myRTC.year);

    myFile.print(" X:");
    myFile.print(mpu6050.getGyroX());
    myFile.print(" Y:");
    myFile.print(mpu6050.getGyroY());
    myFile.print(" Z:");
    myFile.println(mpu6050.getGyroZ());
    // close the file:
    myFile.close();
}
}
delay(10);

}

Your topic was MOVED to its current forum category which is more appropriate than the original as it has nothing to do with Installation and Troubleshooting of the IDE

You can save a small amount of SRAM by using the F macro in all print() statements:
replace this

display.print("Y:");

with this

display.print(F("Y:"));

But the screen and the SD card use up 3/4 of SRAM on the ATmega328, so you probably need an Arduino with more memory.

This does NOT do whatever you think it might do. Look up the "C/C++ comma operator".

if((mpu6050.getGyroX()>0,7)

Thanks for answer.I have an ESP32 Devkit.Can I use same code with new connections?