RAM usage at compile time

I'm working on a project quite needy of RAM on a UNO.

I am constantly keeping an eye on the last message of a succesful compiler run and I noted something I don't quite understand while using a function i defined. I will try to explain giving some numbers.

Let's say I have 300 bytes of RAM left, according to the compiler.

If I use the function once, I get 250 left.
If I use it twice, I get 200 left.
On subsequents uses, I get 250 again.

There are variations if I use it in the setup, loop, or both.

Anyone has an explanation?

Thank you have a nice day

The compiler only reports on statically allocated SRAM. At run time you’ll use more memory for transient storage during functions calls and this will impact SRAM use

If local variables in your function are not static (would have been reported otherwise in Global use) and not allocating their own memory on the heap then they get allocated on the stack and released when the function terminates

Read about heap and stack

For your specifics it all depends on what your code does and how you measure available SRAM