Static variables are stored in the DAT section of the plugin and are present for the entirety of the plugin's lifetime, which means that allocation happens automatically with loading your plugin. It should be obvious by their behavior that, even though they are scoped in the code syntax and the compiler enforces this, they technically are not local to the function. They work exactly the same as global variables in this respect - you just can't access them the same way through code.