This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Increasing a variable size, causes Code and RO-Data to increase (instead of RW-Data)

Hi

I have the following code in cryptography. It is a function which accepts a "key" and "state" inputs and then encrypts state using key.

        uint state[4]={0,1,2,3};
        uint key[8]={1,2,3,4,5,6,7,8};
        Encrypt(state,key);

When I increase size of the "state" variable, I expect to see RW-Data to grow. Because variables are located in RAM. But I see that code size and RO-Data increase instead.

Why ?!

I appreciate your help.

Regards

Parents
  • Are you by any chance declaring these initialized variables within a function instead of globally? This would explain the behavior you are seeing very well.

    local variables do not take up any more RAM than is already allocated for the stack even if your variable overruns the stack size.

Reply
  • Are you by any chance declaring these initialized variables within a function instead of globally? This would explain the behavior you are seeing very well.

    local variables do not take up any more RAM than is already allocated for the stack even if your variable overruns the stack size.

Children
No data