dynamic memory iusse


when I compile my sketch under ide 1.6.1 I get a kind of warning from the compiler.
It tells me that global variables are using 1.741 byte (85%) of dynamic memory, leaving just 307 byte for local variables.
Then in red it tells me that there could be stability problem.

Looking at the code there are not so many global variables. Take a look:

#define TOPCLO      30000     // Tempo apertura/chiusure in millisecondi
#define ITEMS       30           // Numero di misure nella media
#define SCRICCHERO  1000   // Movimento dx in millisecondi

Maxbotix rangeSensorPW(SONARPW_PIN, Maxbotix::PW, Maxbotix::LV);
Maxbotix rangeSensor2PW(SONARPW2_PIN, Maxbotix::PW, Maxbotix::LV);
boolean is_moving=false;
boolean is_open=false;
boolean is_sonar_active=false;
boolean is_panic=false;
boolean inseguimento=false;
boolean logging=false;
boolean spostamento=false;
int DISTSOGLIA = 67;
int dist[ITEMS];

There are no other global variable.
I tried decreasing the number of ITEMS but I would gain just few free bytes
I tried to use just one Maxbotix variable but then again just a tiny gain in free bytes

Where do I waste so much memory then?

Thank you all


Libraries? Hard to tell from a code snippet.


Also when you print constant text without using the F() macro, that is copied to RAM at startup.

Thank you

the F() marco solved my problem!