How much space I need to reserve ?

Good morning

My project have now 40650 bytes of a 126976 bytes maximum.
It's ok?
Which is the limit that I can use to avoid processing problems?

Thanks on advance
Best regards
Pedro Ferrer

You are far more likely to run out of RAM, but without seeing your code (hint), it is impossible to comment.

Which is the limit that I can use to avoid processing problems?

I'm thinking you can go to 126976 bytes before you have problems :), unless GCC/STK download doesn't support 128k yet.

Exactly what do you mean by "processing problems"?


Rob

Good morning

Thanks by your prompt answer.

Exactly what do you mean by "processing problems"?

I don't know very well...
Slow processing...
Lack of memory to process tasks...

Thanks on advance
Best regards
Pedro Ferrer

A large program doesn't run slower than a small one, it all depends on how well it's written and exactly what has to be done. In fact often you make a program faster my making it larger.

A large program MAY be starved for RAM, but once again it depends on what it's doing, it could just as easily use hardly any RAM.

In general I would not worry about these things, if you're learning about this and chose appropriate (ie simple) projects you won't hit any of the Arduino's limits in the near future.


Rob

My project have now 40650 bytes of a 126976 bytes maximum.
Which is the limit that I can use to avoid processing problems?

This "performance misconception" happens in the PC world too. Ever hear: "No wonder my computer is slow! The hard drive is full of photos, music, and video files!"

The used or free space of secondary storage has little impact on a system's performance. The Flash memory on an Arduino is similar to the hard drive in a PC. All it does is store stuff(*). Performance comes from what gets executed.

As Graynomad points out, the code is what matters. Not the size of the code.


(*) Disclaimer: Yes, hard drives can be used for virtual memory but that isn't relevant to the point.

Slow processing

On a PC you can get virtual memory by swapping out parts of your memory to disc, this takes time and results in the program appearing to run slowly. There is no such thing on an arduino and so code will always execute at the same speed.

What you will get as you run out of memory is that you will find variables being corrupted.

If you use avr-size on your .elf files, you'll get a report that includes the size of code ("text"), initialized data ("data"), and uninitialized data ("bss".) The amount of flash consumed is text+data, and that can grow essentially to the actual size of the available flash. The amount of RAM used (usually more critical) is data+bss+stack+heap, where "stack" and "heap" are the amounts of RAM consumed at runtime that aren't actually part of your image. I would say you should start to worry if data+bss starts to get up to about 90% of the amount of RAM in the chip...