Memory is a big issue in Arduino.
1. The available RAM is very small compared to other platforms. For example the Uno has 2k of RAM.
2. There is no sophisticated heap management which means that usage of dynamic memory should be avoided.
3. Programs are expected to run for a long time with zero memory leaks.
There are two types of variables in B4R: local variables and global variables.
Local variables are always created on the stack. This means that any object created in a sub, other than Process_Globals, will be destroyed when the sub ends (this is not the case in other B4X tools).
Global objects, which are objects created in Process_Globals, are not stored in the stack and will always be available.
Note that global variables, except of primitives, behave as constants. You cannot redim them and they cannot be reassigned.