What is the easiest way to count how many global variables are in your sketch code?
1 - The number of variables is not important, but the number of used memory (in bytes) is important. That is shown at the bottom of the Arduino IDE by the compiler when verifying or uploading a sketch.

2 - It is not possible to go to, for example, the largest global variable. You can use the search function to search for something.

For a small microcontroller, for example a Attiny or Atmega8, every byte that uses memory can be important.

For a Arduino Uno and larger, the optimization is done more globally.

To optimize for ram, look for the hungriest memory eaters:


For the Arduino Uno and other avr microcontrollers, the text with
Serial.println can be put in PROGMEM with the F() macro.
Many String
objects might need a lot of heap memory. 
Arrays can get large
quickly. 
Arrays of large elements (float, struct) can get large even
more quickly. 
The SD library uses a lot of ram memory. There is a small version
of the SD library.
Some graphical libraries for displays use a lot of memory.


Try to avoid to save a single byte, unless you check the resulting memory usage. The compiler can optimize code in a way that conflicts with someone trying to save a byte.


When an integer is changed into a byte, 
perhaps all the calculations are still done with integers and the
compiler needs more memory to convert from byte to integer and back.
Perhaps that integer was only used in registers and 
did not use a memory location.
A 'const' integer uses probably no ram memory at all.


Final tip: Don't be afraid to upgrade to an other Arduino board with more memory. If you project uses almost all the memory, then it is not possible to add something to your project. When the project runs for a while, you might want to add an extra sensor or extra functionality.