9 years, 1 month ago.

Global array size limit

If I create a global variable array, the size does not get included in the build details and if I select a size that is bigger than available RAM, I do not get an error. For example "int x[100000]" does not produce an error in the KL05Z. If I refer to x[99999] in my code, then I get an out of space error. How do I know how much RAM I have used? I realize that any non-static variable declared inside a function will be carved out of the stack, but I would think any global variable should reduce the RAM used in the build details.

Thanks, Tom

1 Answer

9 years, 1 month ago.

Are you actually doing anything with those arrays? Otherwise they get optimized out by the compiler.

Accepted Answer

You are right. I had not yet written the code to use the array.

Thanks, Tom

posted by Tom Russell 25 Feb 2015