when i load the code in arduino, i take a message that say that the code's size is 21000bytes, when the max is 32000bytes.
The message that you are relying on tells you how much Flash memory you are using. It does not tell you how much SRAM you are using. I still suspect that you are running out of SRAM.