SCRAMBLECODE uses a memory management model that includes garbage collection (GC). When doing a GC in a VM, all memory occupied by objects that are not referenced anymore will be reclaimed - either being deleted or recycled in some form or another.
This saves the programmer from having to deal with the details of deallocating memory or freeing instantiated objects. The only thing to consider is when to execute a GC on a VM.
This provides the programmer with full control of the memory in use. In certain situations it can provide extra security to have a large memory content. Other situations might dictate low memory consumption or perhaps randomized memory recycling.
When Using @GC.
This function does an internal (local) garbage collection in the executing VM. It is a simple internal GC which can be done anytime during execution of the bytecode.
The Main class and all other objects currently referenced are not affected. However, all memory occupied by objects that are not referenced anymore will be reclaimed.
When Using @VMGC.
This function does an external garbage collection on another VM. The targeted VM is not allowed to currently be executing bytecode.
The function is called with an argument, that specifies whether to include the Main class in the GC or not.
It is useful to exclude the Main class from GC in situations where the VM is called multiple times, and the results from previous calls play a role.
Including the Main class in the GC will remove all objects completely - preparing the VM for a fresh start.