If you use gcc to link the executable / firmware, you can add an option -Map=memory.mapto the command line.
In this file you will find something like this that tells you where the RAM is:
Memory Configuration
Name Origin Length Attributes
FLASH 0x00014000 0x0002c000 xr
RAM 0x20002000 0x00002000 xrw
*default* 0x00000000 0xffffffff
Pay attention to the RAM address ( 0x20002000). Later you will find the addresses of global variables in RAM. The difference in addresses will tell you their size:
.bss 0x20002924 0x94 C:/Users/...../main.cpp.o
0x20002924 i2c
0x20002934 ex1
0x20002948 ex2
0x2000295c sensorI2C
0x20002978 sensorSPI0
0x2000299c sdCard
(.bss) , , . - ( , , . (0x94) , main.cpp, .
. " " (, int a = 1;) .data, ! (, ) , ++, - .bss. .