Hopefully this is not outside the forum scope.

Getting information on how the VB compiler handles various things would be helpful to know whether it is more efficient to code in a certain way. For example a question of late is:

QUESTION
How the compiler handles string memory storage.

I can see three possible alternatives.

1) The compiler stores all strings in a central memory location and just has a pointer reference stored on either the heap or stack.

2) The compiler uses where the string is declared to determine where the string is placed in memory.

In the simplest case if the string is declared locally (Dim strPrompt As String) and then assigned in the local procedure to the local variable, the entire string logically would be put in stack memory.

3) The compiler uses the variable to which the string is assigned to determine where it is stored (heap or stack). In this case, if no local variable is declared, and the string is assigned to a global variable, does the compiler consider the string to belong to the local procedure or does the assignment "rule" ?

If the assignment does Not rule, then the string logically would belong to the local procedure and the assignment to the global variable would cause either a copy of the string to also be stored on the heap (per your above) or pointer reference copied to the heap?