Again: Allowed memory size of 268435456 bytes exhausted

Hello together,

I am playing with Cayenne the first time and already got an error.
No data is shown at the dashboard or at the live-data-tab, just this error:

Error (1.656 sec)
Allowed memory size of 268435456 bytes exhausted (tried to allocate 262406236 bytes)

The TTGO T-Call (ESP32 with SIM800/MQTT) sends the data without any problems.

01:43:48.640 -> Initializing modem…
01:43:58.002 -> Modem: SIM800 R14.18
01:43:58.071 -> [9884] Initializing modem
01:43:58.071 -> [9952] Waiting for network
01:44:18.199 -> [30069] Connecting to GPRS
01:44:25.166 -> [37025] Connected to GPRS
01:44:25.166 -> [37033] IP:
01:44:25.200 -> [37033] Connecting to
01:44:26.782 -> [38658] Connected
01:44:27.493 -> [39375] Publish: topic 4, channel 65534, value ESP32, subkey , key
01:44:27.561 -> [39397] Publish: topic 6, channel 65534, value XtensaLX6, subkey , key
01:44:27.664 -> [39420] Publish: topic 7, channel 65534, value 240000000, subkey , key
01:44:27.730 -> [39488] Publish: topic 5, channel 65534, value 1.3.0, subkey , key
01:44:27.799 -> [39558] Publish: topic 8, channel 65534, value GSM, subkey , key
01:44:27.868 -> OK!
01:44:30.361 -> [42222] Publish: topic 1, channel 0, value 42222, subkey , key
01:44:30.429 -> Sent all values - sleeping

These is just the demo-data-channel with the uptime-data.

I already tried to reregister the device, but with no luck. Another sensor/ESP32/WiFi/MQTT is working fine.

This does not seem to be the first time, this error occur and I already messaged @shramik_salgaonkar about this:

Does somebody know, how to solve it? Or at least, why it appears?

Thanks a lot,

can you share the code you are using.

Of course, but it is a horrible bad quality:

#define CAYENNE_PRINT Serial

// TTGO T-Call pin definitions
#define MODEM_RST            5
#define MODEM_PWKEY          4
#define MODEM_POWER_ON       23
#define MODEM_TX             27
#define MODEM_RX             26
#define I2C_SDA              21
#define I2C_SCL              22

// Configure TinyGSM library
#define TINY_GSM_MODEM_SIM800      // Modem is SIM800

// This sketch uses a software serial connection.
#include <SoftwareSerial.h>
//SoftwareSerial gsmSerial(26, 27); // RX, TX
// If you are using a device that supports a hardware serial (Mega, Leonardo, etc.) and prefer to use
// that you can comment out the above lines and uncomment the one below.
#define gsmSerial Serial1

#include <CayenneMQTTGSM.h>
#include <Wire.h>
#include <TinyGsmClient.h>
#include "utilities.h"

// GSM connection info.
char apn[] = ""; // Access point name. Leave empty if it is not needed.
char gprsLogin[] = ""; // GPRS username. Leave empty if it is not needed.
char gprsPassword[] = ""; // GPRS password. Leave empty if it is not needed.
char pin[] = ""; // SIM pin number. Leave empty if it is not needed.

// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = "xxxxb4d4";
char password[] = "xxxx058d";
char clientID[] = "xxxxd412";

TinyGsm modem(Serial1);
TinyGsmClient client(modem);

int SleepTime = 60000000;
//Values sent/error booleans
bool CayenneSent = false;

void setup() {

  // Keep power when running from battery
  Wire.begin(I2C_SDA, I2C_SCL);
    bool   isOk = setPowerBoostKeepOn(1);
  Serial.println(String("IP5306 KeepOn ") + (isOk ? "OK" : "FAIL"));
  // Set-up modem reset, enable, power pins

  digitalWrite(MODEM_PWKEY, LOW);
  digitalWrite(MODEM_RST, HIGH);
  digitalWrite(MODEM_POWER_ON, HIGH);

  // Set GSM module baud rate and UART pins
  Serial1.begin(115200, SERIAL_8N1, MODEM_RX, MODEM_TX);

  // Restart takes quite some time
  // To skip it, call init() instead of restart()
  Serial.println("Initializing modem...");
  // Or, use modem.init() if you don't need the complete restart

  String modemInfo = modem.getModemInfo();
  Serial.print("Modem: ");
  //Serial.println("Setup Cayenne...");
  Cayenne.begin(username, password, clientID, gsmSerial, apn, gprsLogin, gprsPassword, pin);
  CayenneSent = false;

void loop() {
  //Run Cayenne Functions
	if (CayenneSent){
      Serial.println("Sent all values - sleeping");

    Cayenne.virtualWrite(0, millis());
    //Set CayenneSent to true so we know when to sleep
    CayenneSent = true;

It is based on this:


can you delete the widget from the dashboard and change:


Cayenne.virtualWrite(1, 22, "temp", "c");

after you upload the code, it will auto create a new green widget. Add it by clicking on “+” on the widget.

Also, i would suggest you remove the sleep for time being for testing.