Low memory available, stability problems may occur.

I guess i am not the first to get this . We have a pcb with atmega328p .

Global variables use 1,553 bytes (75%) of dynamic memory, leaving 495 bytes for local variables. Maximum is 2,048 bytes.

I will have to free up memory, and hence to understand a few things ,before showing my code.

1.I dont have many global variables, but i do have many arrays INSIDE functions , what i know is that these arrays are "dead" when function is ended. Is that right ? should i put some efforts on reducing these vars also ? are they effect my program ?

2.Is there any tool for the IDE, to show me where is my main consumption and how can i improve it ?

3.May be sound stupid, but lets say i used my vars space wisely, and yet i dont have enough room, my only option would be external memory or another chip ?

  1. I have many #defines in the code, are they take memory ? i know they dont. .is it wrong ?

thanks a lot .

what i know is that these arrays are "dead" when function is ended. Is that right ?

Do you KNOW that, or not? The question indicates not. Local variables, including arrays, go out of scope when the function ends. That means that the memory that they use can be (but not necessarily will be) reused.

should i put some efforts on reducing these vars also ?

Yes.

are they effect my program ?

Of course.

2.Is there any tool for the IDE, to show me where is my main consumption and how can i improve it ?

No.

3.May be sound stupid, but lets say i used my vars space wisely, and yet i dont have enough room, my only option would be external memory or another chip ?

Only the Mega can use external memory.

(depend on the definition of knowing, people say "i know" not always means they know the right thing, so usually no one takes it too seriously, unless we speak about serious issues like knowing its going to be a war)
So i may be missing something here ,
if i change local variables, i don't see a change in the IDE memory usage , why is that ?
Does he see only globals, where locals can put some pressure on the software during runtime ?

You also said that at the end of a function , local vars space is not always being used. that means i should take them into account for my whole program memory ? or shouldn't i ?

So i may be missing something here ,

We certainly are - your code

Local variables go on the stack, unless they're static

Great , so the code has 16 files, each has about 1000-2000 lines , would you like me to post it here ?
Would you go over all this code if i post it here ? if you have the time for it, i will definitely send it to you ......

Great , so the code has 16 files, each has about 1000-2000 lines , would you like me to post it here ?

Yup, but remember to use code tags, please.

You can PM it to me if you wish, but I suggest you look at my rate-card first.