R4 wifi led matrix crashes when printing « … »

Hi, I am using an arduino R4 wifi in order to display on the onboard led matrix messages that are sent via the iot messenger widget to a MatrixWrite() command.
The messages are Strings.
The sketch runs roughly smoothly but crashed from time to time, and I finally realized that the sketch crashes each time that I sent 3 point in a row (…). I have absolutely no clue why it is the case.
I know that using Strings is suboptimal for memory management, but I have no choice as this is the standard output of the messenger widget. I use the reserve() command to try to keep the memory as clean as possible.
Note that for every message received, an other string is created to include spaces before and after the message for proper display. I think this is the source of the issue, but I am still wondering why:

XXXMsgXXX="   ";
XXXMsgXXX+=MSG;
XXXMsgXXX+="   ";

Any idea on the source of these crashes?

See below the overall sketch:

/*
  Sketch generated by the Arduino IoT Cloud Thing "Untitled 4"
  https://create.arduino.cc/cloud/things/33b5abdd-5b4b-40e8-b57c-d5e911e30de9

  Arduino IoT Cloud Variables description

  The following variables are automatically generated and updated when changes are made to the Thing

  String MSG;
  int compteur;
  bool syncLed;

  Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
  which are called when their values are changed from the Dashboard.
  These functions are generated with the Thing and added at the end of this sketch.

*/

#include "thingProperties.h"
#include "ArduinoGraphics.h"
#include "Arduino_LED_Matrix.h"
#include "WiFiS3.h"

#define DEBUG 0 // set 1 for debugging; mremoves debuggibg code before compiling if not required
#if DEBUG ==1
#define debug(x) Serial.print(x)
#define debugln(x) Serial.println(x)
#else
#define debug(x)
#define debugln(x)
#endif

unsigned long previousMillis = 0;
const unsigned long TextInterval = 2500; //definit le temps entre 2 messages (en millisecondes)

String XXXMsgXXX;
ArduinoLEDMatrix matrix;
const char BootText[] = "   Booting...   ";

void setup() {

Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
MSG.reserve(91);
XXXMsgXXX.reserve(100);

matrix.begin();
initProperties(); // Defined in thingProperties.h
ArduinoCloud.begin(ArduinoIoTPreferredConnection); // Connect to Arduino IoT Cloud
XXXMsgXXX = String(BootText);
MatrixWrite(XXXMsgXXX);
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
compteur = 0;
}

void loop() {
ArduinoCloud.update();
PrintText();
}

void PrintText() {
unsigned long currentMillis = millis();

if (currentMillis - previousMillis > TextInterval) 
{
MatrixWrite(XXXMsgXXX);
compteur++;
debug(F("compteur:"));
debugln(compteur);
previousMillis = millis();
digitalWrite(LED_BUILTIN, syncLed);
syncLed = 1 - syncLed;
}
}


void MatrixWrite(String &i) 
{
matrix.beginDraw();
matrix.stroke(0xFFFFFFFF);
matrix.textScrollSpeed(25);
matrix.textFont(Font_5x7);
matrix.beginText(0, 1, 0xFFFFFF);
matrix.println(i);
matrix.endText(SCROLL_LEFT);
matrix.endDraw();

}

void onMSGChange() {
debugln(MSG);
XXXMsgXXX="   ";
XXXMsgXXX+=MSG;
XXXMsgXXX+="   ";
debugln(XXXMsgXXX);
}

void onCompteurChange() {
{
}

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

IIRC the AVR will crash if you send three exclamation points in a row "!!!". I wonder if there's something similar?

It was actually an upload failure, not a crash. A very old version of the bootloader used on the Mega (and only on the Mega) had the "monitor" feature enabled. This was disabled many years ago, both in the bootloader that ships on the boards and in the one included in the "Arduino AVR Boards" platform.

I suffered from this when I started using Arduino because my board had that version of the bootloader, but haven't seen any reports of it for years. I actually tried to reproduce the fault recently and was not able to even though I flashed the problematic bootloader to my board.

A funny symptom of the fault was that you would see something like "Bootloader> Huh?" printed in the AVRDUDE output.