SSD1306 allocation failed error , i need your help with this one , any suggestions

/* oled library*/
#include<math.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
/*Temperature*/
#include <OneWire.h>
#include <DallasTemperature.h>
/*ADXL345 accelerometer*/
#include <Adafruit_Sensor.h>
#include <Adafruit_ADXL345_U.h>
#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(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
#define LOGO_HEIGHT   16
#define LOGO_WIDTH    16
#define ledPin_1 13 // choose the pin for the LED  start led
#define ledPin_2 12 // 2nd led
#define ledPin_3 11 // 3rd led
#define switchPin_1 7 // choose the input pin (for a pushbutton) start_switch
#define switchPin_2 4 // 2nd switch
#define switchPin_3 5 // 3rd switch
#define ONE_WIRE_BUS 3
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
Adafruit_ADXL345_Unified accel = Adafruit_ADXL345_Unified();
//pulse sensor
byte a = 0;
byte lasta = 0;
byte lastb = 0;
byte LastTime = 0;
byte ThisTime;
bool BPMTiming = false;
bool BeatComplete = false;
byte BPM = 0;
#define UpperThreshold 560
#define LowerThreshold 530
//buzzer
#define buzzer 2
byte switch_status_1 = 0; // variable for reading the pin status
byte switch_status_2 = 0;
byte switch_status_3 = 0;
byte ledStatus_1 = 0; //see if led is on; high on; low off;
byte ledStatus_2 = 0;
byte ledStatus_3 = 0;
bool all_led_status = false; // true if any led is led up
double magnitudePrevious = 0;
byte footstep = 0;
void display_oled_welcome() {
  // This function displays a welcome message on the OLED display.
  display.clearDisplay();  // Clear the display buffer
  
  // Set the text properties
  display.setTextSize(2);
  display.setTextColor(WHITE);
  
  // Set the cursor position and print the welcome message
  display.setCursor(21, 21);
  display.println("Welcome");
  
  // Display the content on the OLED display
  display.display();
  
  delay(3000);  // Delay for 3 seconds to show the welcome message
  display.clearDisplay();  // Clear the display buffer after displaying the message
}
void setup()
{
  Serial.begin(9600);
  pinMode(ledPin_1, OUTPUT); // declare LED as output
  pinMode(ledPin_2, OUTPUT); // declare LED as output
  pinMode(ledPin_3, OUTPUT); // declare LED as output

  pinMode(switchPin_1, INPUT); // declare pushbutton as input
  pinMode(switchPin_2, INPUT); // declare pushbutton as input
  pinMode(switchPin_3, INPUT); // declare pushbutton as input
  //oled setup
  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS);
  if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
    for (;;); // Don't proceed, loop forever
  }
  // Show initial display buffer contents on the screen --
  // the library initializes this with an Adafruit splash screen.
  display.display();
  delay(2000); // Pause for 2 seconds
  // Clear the buffer
  display.clearDisplay();
  display_oled_welcome();
  oled_home_display();
  pinMode(buzzer, OUTPUT);
  buzzer_start_tone();
  sensors.begin();
  if (!accel.begin())
  {
    Serial.println("No ADXL345 sensor detected.");
    while (1);
  }
}
void loop()
{
  serialStatusPrint();
  first_Switch_led();
  second_Switch_led();
  third_Switch_led();
}
void serialStatusPrint(void) {
  Serial.print("ledStatus_1 = ");
  Serial.print(ledStatus_1);
  Serial.print("  Switch Status_1 = ");
  Serial.print(switch_status_1);
  Serial.println();
  Serial.print("ledStatus_2 = ");
  Serial.print(ledStatus_2);
  Serial.print("  Switch Status_2 = ");
  Serial.print(switch_status_2);
  Serial.println();
  Serial.print("ledStatus_3 = ");
  Serial.print(ledStatus_3);
  Serial.print("  Switch Status_3 = ");
  Serial.print(switch_status_3);
  Serial.println();
  delay(250);
}

void first_Switch_led() {
  ledStatus_1 = digitalRead(ledPin_1);
  switch_status_1 = digitalRead(switchPin_1); // read input value
  if (switch_status_1 == HIGH)
  { // check if the input is HIGH (button pressed)
    if (ledStatus_1 == LOW) {
      all_led_off(); //turn off any open led
      digitalWrite(ledPin_1, HIGH); // turn LED ON
      delay(1000);
      ledStatus_1 = digitalRead(ledPin_1);
      while (ledStatus_1) {
        temperature_sensor();
        first_Switch_led();
        second_Switch_led();
        third_Switch_led();
      }
      oled_home_display();
    } else
      digitalWrite(ledPin_1, LOW); // turn led OFF
    ledStatus_1 = digitalRead(ledPin_1);
    delay(1000);
  }
}
void second_Switch_led() {
  ledStatus_2 = digitalRead(ledPin_2);
  switch_status_2 = digitalRead(switchPin_2); // read input value
  if (switch_status_2 == HIGH)
  { // check if the input is HIGH (button released)
    if (ledStatus_2 == LOW) {
      all_led_off(); //turn off any open led
      digitalWrite(ledPin_2, HIGH); // turn LED ON
      delay(1000);
      ledStatus_2 = digitalRead(ledPin_2);
      while (ledStatus_2) {
        pulse_sensor();
        first_Switch_led();
        second_Switch_led();
        third_Switch_led();
      }
      display.clearDisplay();
      oled_home_display();
    }
  } else {
    digitalWrite(ledPin_2, LOW); // turn led OFF
  delay(1000);
  }
}

void third_Switch_led() {
  ledStatus_3 = digitalRead(ledPin_3);
  switch_status_3 = digitalRead(switchPin_3); // read input value
  if (switch_status_3 == HIGH)
  { // check if the input is HIGH (button released)
    if (ledStatus_3 == LOW) {
      all_led_off(); //turn off any open led
      digitalWrite(ledPin_3, HIGH); // turn LED ON
      delay(1000);
      ledStatus_3 = digitalRead(ledPin_3);
      display.clearDisplay();
      while (ledStatus_3) {
        footstep_cal();
        first_Switch_led();
        second_Switch_led();
        third_Switch_led();
      }
      display.clearDisplay();
      oled_home_display();
    } else
      digitalWrite(ledPin_3, LOW); // turn led OFF
    delay(1000);
  }
}
void all_led_off() {
  digitalWrite(ledPin_1, LOW);
  digitalWrite(ledPin_2, LOW);
  digitalWrite(ledPin_3, LOW);
  //delay(1000);
}

void oled_welcome_display() {
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(21, 21);
  display.print("WELCOME");
  display.display();
  delay(3000);
  display.clearDisplay();
}
void oled_home_display() {
  display.clearDisplay();
  display.setTextSize(0.9);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.print("Press the following  bottons to continue..");
  display.setCursor(1, 27);
  display.print("1.Temperature 2.Pulse");
  display.setCursor(1, 42);
  display.print("3.Footstep");
  display.display();
}

void temperature_sensor() {
  // Send the command to get temperatures
  sensors.requestTemperatures();
  display.clearDisplay();
  //print the temperature in Celsius
  float temperature_value_celsius =  sensors.getTempCByIndex(0);
  Serial.print("Temperature: ");
  Serial.print(temperature_value_celsius);
  Serial.print((char)176);//shows degrees character
  Serial.print("C  |  ");

  //Oled display temperature Celsius
  display.setTextSize(1);
  display.setCursor(0, 0);
  display.print("Temperature: ");
  display.setTextSize(2);
  display.setCursor(0, 10);
  display.print(temperature_value_celsius);
  display.print(" ");
  display.setTextSize(1);
  display.cp437(true);
  display.write(167);
  display.setTextSize(2);
  display.print("C");

  //print the temperature in Fahrenheit
  float temperature_value_fahrenheit = (temperature_value_celsius * 9.0) / 5.0 + 32.0;
  Serial.print(temperature_value_fahrenheit);
  Serial.print((char)176);//shows degrees character
  Serial.println("F");

  // Oled display temperature Celsius
  display.setTextSize(1);
  display.setCursor(0, 35);
  display.print("Humidity: ");
  display.setTextSize(2);
  display.setCursor(0, 45);
  display.print(temperature_value_fahrenheit);
  display.print(" ");
  display.setTextSize(1);
  display.cp437(true);
  display.write(167);
  display.setTextSize(2);
  display.print("F");

  if (temperature_value_celsius < 100) {
    buzzer_alart_temp(5000);
  }

  display.cp437(false);

  display.display();
  delay(500);
}

void pulse_sensor() {
  display.setTextSize(2);
  if (a > 127)
  {
    display.clearDisplay();
    a = 0;
    lasta = a;
  }
  ThisTime = millis();
  int value = analogRead(0);
  Serial.println(value);
  delay(100);
  display.setTextColor(WHITE);
  int b = 60 - (value / 16);
  display.writeLine(lasta, lastb, a, b, WHITE);
  lastb = b;
  lasta = a;
  if (value > UpperThreshold)
  {
    if (BeatComplete)
    {
      BPM = ThisTime - LastTime;
      BPM = int(60 / (float(BPM) / 1000));
      BPMTiming = false;
      BeatComplete = false;
      tone(8, 1000, 250);
    }
    if (BPMTiming == false)
    {
      LastTime = millis();
      BPMTiming = true;
    }
  }
  if ((value < LowerThreshold) & (BPMTiming))
    BeatComplete = true;
  display.writeFillRect(0, 50, 128, 16, BLACK);
  display.setCursor(0, 50);
  display.print("BPM:");
  display.print(BPM);
  if (BPM > 90) {
    buzzer_alart_pulse(1000);
  }
  display.display();
  a++;
  Serial.print("Pulse : ");
  Serial.print(value);
  Serial.print(" BPM: ");
  Serial.print(BPM);
  Serial.println();

}
void buzzer_start_tone() {
  tone(buzzer, 500); // Send 1KHz sound signal...
  delay(250);        // ...for 1 sec
  noTone(buzzer);     // Stop sound...
  delay(250);
  tone(buzzer, 500);
  delay(500);
  noTone(buzzer);
}

void buzzer_alart_temp(int tonee) {
  tone(buzzer, tonee); // Send 1KHz sound signal...
  delay(250);        // ...for 1 sec
  noTone(buzzer);     // Stop sound...
  delay(250);
  tone(buzzer, tonee);
  delay(500);
  noTone(buzzer);
}
void buzzer_alart_pulse(int tonee) {
  tone(buzzer, tonee); // Send 1KHz sound signal...
  delay(250);        // ...for 1 sec
  noTone(buzzer);     // Stop sound...
  delay(250);
}

void footstep_cal() {
  sensors_event_t event;
  accel.getEvent(&event);

  double x_acc = event.acceleration.x;
  double y_acc = event.acceleration.y;
  double z_acc = event.acceleration.z;

  double magnitude = sqrt(x_acc * x_acc + y_acc * y_acc + z_acc * z_acc);
  double magnitudeDelta = magnitude - magnitudePrevious;
  magnitudePrevious = magnitude;

  if (magnitudeDelta > 6) {
    footstep++;
  }
  delay(10);
  display.clearDisplay();
  display.setTextSize(1.9);
  display.setTextColor(WHITE);
  display.setCursor(0, 26);
  display.print("Footstop(s) : ");
  display.print(footstep);
  display.display();
  Serial.print("Footstep(s) : ");
  Serial.print(footstep);
  Serial.println();
}
//void bluetooth() {
//  if (Serial.available > 0) {
//    inputByte = Serial.read();
//  }
//}

You could make better use of the F()macro for your prints
You could tell us what processor you're using, and what the memory usage stats are

its project to create a portable physiological parameter monitor based on arduino uno and Atmega328p microcontroller , after compiling the code it says
Sketch uses 25284 bytes (88%) of program storage space. Maximum is 28672 bytes.
Global variables use 957 bytes (46%) of dynamic memory, leaving 1091 bytes for local variables. Maximum is 2048 bytes.

Have you tried the example sketch for the SSD1306 from the Adafruit library ?

It looks like even using the F() macro, it's going to be tight, but if all you're putting on the screen is text, you may find a text-only library will require less memory.

how do i do that

Look for a library for your display that doesn't need a frame buffer.
(This assumes you never want to display graphics)

thank you , i will try this

Try this Text Only SSD library.

RE: "SSD1306 allocation failed" error

i am having the same issue too and i tried what you suggested and it didn't work

this is my code , can you help me

/* oled library*/
#include<math.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
/*Temperature*/
#include <OneWire.h>
#include <DallasTemperature.h>
/*ADXL345 accelerometer*/
#include <Adafruit_Sensor.h>
#include <Adafruit_ADXL345_U.h>
#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(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
#define LOGO_HEIGHT   16
#define LOGO_WIDTH    16
#define ledPin_1 13 // choose the pin for the LED  start led
#define ledPin_2 12 // 2nd led
#define ledPin_3 11 // 3rd led
#define switchPin_1 7 // choose the input pin (for a pushbutton) start_switch
#define switchPin_2 4 // 2nd switch
#define switchPin_3 5 // 3rd switch
#define ONE_WIRE_BUS 3
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
Adafruit_ADXL345_Unified accel = Adafruit_ADXL345_Unified();
//pulse sensor
byte a = 0;
byte lasta = 0;
byte lastb = 0;
byte LastTime = 0;
byte ThisTime;
bool BPMTiming = false;
bool BeatComplete = false;
byte BPM = 0;
#define UpperThreshold 560
#define LowerThreshold 530
//buzzer
#define buzzer 2
byte switch_status_1 = 0; // variable for reading the pin status
byte switch_status_2 = 0;
byte switch_status_3 = 0;
byte ledStatus_1 = 0; //see if led is on; high on; low off;
byte ledStatus_2 = 0;
byte ledStatus_3 = 0;
bool all_led_status = false; // true if any led is led up
double magnitudePrevious = 0;
byte footstep = 0;
void display_oled_welcome() {
  // This function displays a welcome message on the OLED display.
  display.clearDisplay();  // Clear the display buffer
  
  // Set the text properties
  display.setTextSize(2);
  display.setTextColor(WHITE);
  
  // Set the cursor position and print the welcome message
  display.setCursor(21, 21);
  display.println("Welcome");
  
  // Display the content on the OLED display
  display.display();
  
  delay(3000);  // Delay for 3 seconds to show the welcome message
  display.clearDisplay();  // Clear the display buffer after displaying the message
}
void setup()
{
  Serial.begin(9600);
  pinMode(ledPin_1, OUTPUT); // declare LED as output
  pinMode(ledPin_2, OUTPUT); // declare LED as output
  pinMode(ledPin_3, OUTPUT); // declare LED as output

  pinMode(switchPin_1, INPUT); // declare pushbutton as input
  pinMode(switchPin_2, INPUT); // declare pushbutton as input
  pinMode(switchPin_3, INPUT); // declare pushbutton as input
  //oled setup
  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS);
  if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
    for (;;); // Don't proceed, loop forever
  }
  // Show initial display buffer contents on the screen --
  // the library initializes this with an Adafruit splash screen.
  display.display();
  delay(2000); // Pause for 2 seconds
  // Clear the buffer
  display.clearDisplay();
  display_oled_welcome();
  oled_home_display();
  pinMode(buzzer, OUTPUT);
  buzzer_start_tone();
  sensors.begin();
  if (!accel.begin())
  {
    Serial.println("No ADXL345 sensor detected.");
    while (1);
  }
}
void loop()
{
  serialStatusPrint();
  first_Switch_led();
  second_Switch_led();
  third_Switch_led();
}
void serialStatusPrint(void) {
  Serial.print("ledStatus_1 = ");
  Serial.print(ledStatus_1);
  Serial.print("  Switch Status_1 = ");
  Serial.print(switch_status_1);
  Serial.println();
  Serial.print("ledStatus_2 = ");
  Serial.print(ledStatus_2);
  Serial.print("  Switch Status_2 = ");
  Serial.print(switch_status_2);
  Serial.println();
  Serial.print("ledStatus_3 = ");
  Serial.print(ledStatus_3);
  Serial.print("  Switch Status_3 = ");
  Serial.print(switch_status_3);
  Serial.println();
  delay(250);
}

void first_Switch_led() {
  ledStatus_1 = digitalRead(ledPin_1);
  switch_status_1 = digitalRead(switchPin_1); // read input value
  if (switch_status_1 == HIGH)
  { // check if the input is HIGH (button pressed)
    if (ledStatus_1 == LOW) {
      all_led_off(); //turn off any open led
      digitalWrite(ledPin_1, HIGH); // turn LED ON
      delay(1000);
      ledStatus_1 = digitalRead(ledPin_1);
      while (ledStatus_1) {
        temperature_sensor();
        first_Switch_led();
        second_Switch_led();
        third_Switch_led();
      }
      oled_home_display();
    } else
      digitalWrite(ledPin_1, LOW); // turn led OFF
    ledStatus_1 = digitalRead(ledPin_1);
    delay(1000);
  }
}
void second_Switch_led() {
  ledStatus_2 = digitalRead(ledPin_2);
  switch_status_2 = digitalRead(switchPin_2); // read input value
  if (switch_status_2 == HIGH)
  { // check if the input is HIGH (button released)
    if (ledStatus_2 == LOW) {
      all_led_off(); //turn off any open led
      digitalWrite(ledPin_2, HIGH); // turn LED ON
      delay(1000);
      ledStatus_2 = digitalRead(ledPin_2);
      while (ledStatus_2) {
        pulse_sensor();
        first_Switch_led();
        second_Switch_led();
        third_Switch_led();
      }
      display.clearDisplay();
      oled_home_display();
    }
  } else {
    digitalWrite(ledPin_2, LOW); // turn led OFF
  delay(1000);
  }
}

void third_Switch_led() {
  ledStatus_3 = digitalRead(ledPin_3);
  switch_status_3 = digitalRead(switchPin_3); // read input value
  if (switch_status_3 == HIGH)
  { // check if the input is HIGH (button released)
    if (ledStatus_3 == LOW) {
      all_led_off(); //turn off any open led
      digitalWrite(ledPin_3, HIGH); // turn LED ON
      delay(1000);
      ledStatus_3 = digitalRead(ledPin_3);
      display.clearDisplay();
      while (ledStatus_3) {
        footstep_cal();
        first_Switch_led();
        second_Switch_led();
        third_Switch_led();
      }
      display.clearDisplay();
      oled_home_display();
    } else
      digitalWrite(ledPin_3, LOW); // turn led OFF
    delay(1000);
  }
}
void all_led_off() {
  digitalWrite(ledPin_1, LOW);
  digitalWrite(ledPin_2, LOW);
  digitalWrite(ledPin_3, LOW);
  //delay(1000);
}

void oled_welcome_display() {
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(21, 21);
  display.print("WELCOME");
  display.display();
  delay(3000);
  display.clearDisplay();
}
void oled_home_display() {
  display.clearDisplay();
  display.setTextSize(0.9);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.print("Press the following  bottons to continue..");
  display.setCursor(1, 27);
  display.print("1.Temperature 2.Pulse");
  display.setCursor(1, 42);
  display.print("3.Footstep");
  display.display();
}

void temperature_sensor() {
  // Send the command to get temperatures
  sensors.requestTemperatures();
  display.clearDisplay();
  //print the temperature in Celsius
  float temperature_value_celsius =  sensors.getTempCByIndex(0);
  Serial.print("Temperature: ");
  Serial.print(temperature_value_celsius);
  Serial.print((char)176);//shows degrees character
  Serial.print("C  |  ");

  //Oled display temperature Celsius
  display.setTextSize(1);
  display.setCursor(0, 0);
  display.print("Temperature: ");
  display.setTextSize(2);
  display.setCursor(0, 10);
  display.print(temperature_value_celsius);
  display.print(" ");
  display.setTextSize(1);
  display.cp437(true);
  display.write(167);
  display.setTextSize(2);
  display.print("C");

  //print the temperature in Fahrenheit
  float temperature_value_fahrenheit = (temperature_value_celsius * 9.0) / 5.0 + 32.0;
  Serial.print(temperature_value_fahrenheit);
  Serial.print((char)176);//shows degrees character
  Serial.println("F");

  // Oled display temperature Celsius
  display.setTextSize(1);
  display.setCursor(0, 35);
  display.print("Humidity: ");
  display.setTextSize(2);
  display.setCursor(0, 45);
  display.print(temperature_value_fahrenheit);
  display.print(" ");
  display.setTextSize(1);
  display.cp437(true);
  display.write(167);
  display.setTextSize(2);
  display.print("F");

  if (temperature_value_celsius < 100) {
    buzzer_alart_temp(5000);
  }

  display.cp437(false);

  display.display();
  delay(500);
}

void pulse_sensor() {
  display.setTextSize(2);
  if (a > 127)
  {
    display.clearDisplay();
    a = 0;
    lasta = a;
  }
  ThisTime = millis();
  int value = analogRead(0);
  Serial.println(value);
  delay(100);
  display.setTextColor(WHITE);
  int b = 60 - (value / 16);
  display.writeLine(lasta, lastb, a, b, WHITE);
  lastb = b;
  lasta = a;
  if (value > UpperThreshold)
  {
    if (BeatComplete)
    {
      BPM = ThisTime - LastTime;
      BPM = int(60 / (float(BPM) / 1000));
      BPMTiming = false;
      BeatComplete = false;
      tone(8, 1000, 250);
    }
    if (BPMTiming == false)
    {
      LastTime = millis();
      BPMTiming = true;
    }
  }
  if ((value < LowerThreshold) & (BPMTiming))
    BeatComplete = true;
  display.writeFillRect(0, 50, 128, 16, BLACK);
  display.setCursor(0, 50);
  display.print("BPM:");
  display.print(BPM);
  if (BPM > 90) {
    buzzer_alart_pulse(1000);
  }
  display.display();
  a++;
  Serial.print("Pulse : ");
  Serial.print(value);
  Serial.print(" BPM: ");
  Serial.print(BPM);
  Serial.println();

}
void buzzer_start_tone() {
  tone(buzzer, 500); // Send 1KHz sound signal...
  delay(250);        // ...for 1 sec
  noTone(buzzer);     // Stop sound...
  delay(250);
  tone(buzzer, 500);
  delay(500);
  noTone(buzzer);
}

void buzzer_alart_temp(int tonee) {
  tone(buzzer, tonee); // Send 1KHz sound signal...
  delay(250);        // ...for 1 sec
  noTone(buzzer);     // Stop sound...
  delay(250);
  tone(buzzer, tonee);
  delay(500);
  noTone(buzzer);
}
void buzzer_alart_pulse(int tonee) {
  tone(buzzer, tonee); // Send 1KHz sound signal...
  delay(250);        // ...for 1 sec
  noTone(buzzer);     // Stop sound...
  delay(250);
}

void footstep_cal() {
  sensors_event_t event;
  accel.getEvent(&event);

  double x_acc = event.acceleration.x;
  double y_acc = event.acceleration.y;
  double z_acc = event.acceleration.z;

  double magnitude = sqrt(x_acc * x_acc + y_acc * y_acc + z_acc * z_acc);
  double magnitudeDelta = magnitude - magnitudePrevious;
  magnitudePrevious = magnitude;

  if (magnitudeDelta > 6) {
    footstep++;
  }
  delay(10);
  display.clearDisplay();
  display.setTextSize(1.9);
  display.setTextColor(WHITE);
  display.setCursor(0, 26);
  display.print("Footstop(s) : ");
  display.print(footstep);
  display.display();
  Serial.print("Footstep(s) : ");
  Serial.print(footstep);
  Serial.println();
}
//void bluetooth() {
//  if (Serial.available > 0) {
//    inputByte = Serial.read();
//  }
//}

using a UNO and a SSD1306 if I run File>Examples>Adafruit SSD1306> SSD1306_128*32_i2c it works OK
if I load your program it displays

SSD1306 allocation failed

when linking it displays

Sketch uses 25266 bytes (78%) of program storage space. Maximum is 32256 bytes.
Global variables use 957 bytes (46%) of dynamic memory, leaving 1091 bytes for local variables. Maximum is 2048 bytes.

when the SSD1306 display.begin() is executed it allocates a buffer which I assume is running you out of dynamic memory

if you have a Mega try the program on that

okay , thx let me try it

maybe try calling display.begin once instead of twice..
and i'd keep the one in the if statement..
but yes, uno doesn't have allot of ram..
might want to try smaller screen lib, like SSD1306Ascii..
make a sketch just for testing screen..

good luck.. ~q

@sakindi, please do not hijack nor cross-post. Thread split then merged.