In the current implementation, the VM simply copies the entire environment when creating the new one and append the new values to it. This will waste a lot of heap space as there is more heap space occupied (from the predefined function prelude).
Solution:
When creating a new environment, we will keep a reference to the current environment for iterative lookup to previously defined names to reduce the space wastage, similar to the environment model in Source Academy.