Dynamic languages ββand variable allocation
The compiler allocates enough memory for each variable to hold the pointer plus any metadata required by the language. But I think you want to ask how much memory is allocated for each object . In this case, the answer is that it depends on the type of object. When a variable is assigned to another object, the pointer associated with that variable changes what it points to.
a source to share
The answer, of course, depends on the language - both the hosted dynamic language and the lower-level implementation language. What is Perl is not necessarily Python, and what is used in Tcl is applied in Java or LISP or ... well, they are considered dynamic languages.
Perl has a C-level structure called an SV (scalar variable) name that contains different storage for different versions of a variable's value. They are often heap-based; storage for strings always ends with a heap-based radix, although a purely numeric value that has never been converted to a string might be in SV, which is strictly on the stack. In Perl, these things count (and mortal, or immortalized, and all sorts of other interesting terms). More complex types (AV, HV, RV, etc.) are based on SV.
a source to share