Short story... you compile your program (sketch) for your AVR Microcontroller (Arduino) and you see that the reported dynamic memory usage, or flash memory usage of your program is more than, or dangerously close to, the total available ram/flash of your microcontroller. You want to find out who the biggest (global) users of your RAM/FLASH are so you can try and trim some fat. Simply upload your compiled .elf (Arduino users see tip below for finding it) and a brief report will be shown showing you potential areas in which you could look for optimisations.

Arduino Users: the .elf file is created as part of the compile process, you will find it in the build directory. Go to File > Preferences, turn on verbose output during Compilation and Upload, do a Verify, and in the message console look for the "{something}.ino.elf" file on a line at the end of the process, that is your .elf file.

Files are in theory deleted after running the examination, no data is stored in theory, but usage at your own risk etc...

Further Learning

What is SRAM, Flash?

This is a simplification to give a basic understanding.

Your microcontroller has two (or more, but for now let's focus on two) types of memory, Flash and SRAM (aka Ram, or Dynamic Memory)

Flash is where the program instructions (and PROGMEM data such as F() strings in Arduino) get stored, it is written to when you program the chip.

Ram is where the program data (variables) get stored, it is blank every time you power the chip on or hit reset.

Because the Ram is blank when you start the chip, the initial values (initialisation) of the variables you have are also stored in Flash, and then copied to Ram when the program starts as necessary.

So what are the numbers that show in the Arduino IDE?

If we take for example the ASCIITable example...

Sketch uses 2,434 bytes (7%) of program storage space. Maximum is 32,256 bytes. Global variables use 262 bytes (12%) of dynamic memory, leaving 1,786 bytes for local variables. Maximum is 2,048 bytes.

This means that our Flash usage is 2434 bytes, while our global (and static) variables use a minimum of 262 bytes of our SRAM (dynamic memory).

If the Arduino IDE (avr-size) says I'm not using all the dynamic memory, why am I running out?

It is impossible for the compiler to know how much memory you will use at any given time. The memory usage it reports is only the minimum memory that you require at all times.

To see why this is, imagine your program uses 1 byte every time button "A" is pressed and releases it every time button "B" is pressed, so you can see that it would be impossible for the compiler to say you will use a certain amount of memory because it doesn't know how many times you will press buttons A and B in advance.

Is it OK to use every byte of the Flash memory?

Usually yes that's just fine to use all the FLASH memory (program storage space) for your program, because once the program is running it normally should not ever attempt to modify the program memory. If it wasn't ok in your case, you are already advanced enough to know it's not ok so I don't need to explain it further.