Low memory available

I builded a sketch on my Arduino Nano v3 and get the next message
"Global variables use 1584 bytes (77%) of dynamic memory, leaving 464 bytes for local variables. Maximum is 2048 bytes.
Low memory available, stability problems may occur.
An error occurred while uploading the sketch"

What happens?
My programs executes fine.
Shall I be afraid to extend my program?

ArduinoStarter1:
My programs executes fine.

But it may be unstable or unreliable, as the message says.
If that is of no concern then no action required, if it is of concern then raise the issue, and post your code, in the Programming section.

If it works it works, but effectively, yes you should avoid extending the sketch.

Alternatively you may be able to reduce your sketches memory use. Something I find makes a big difference is using PROGMEM to put static data in flash rather than RAM[1]. If you're doing a lot of serial logging this can be a big and easy win, e.g.

Serial.println("Hello world");

Replace with:

Serial.println(F("Hello world"));

The F() macro makes the compiler store the string in flash.

After that you can look at slimming down individual variables, e.g. don't use a 16 bit int if an 8 bit int would do, that sort of thing.

[1] PROGMEM - Arduino Reference

It depends on your sketch if it poses an issue or not.

If you deeply nest function calls, it can pose a problem.
If you use Strings (capital S) the wrong way, it more than likely will pose a problem.

tomparkin:
The F() macro makes the compiler store leave the string in flash.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.