There are few design principles that go trough the program.
Memory allocation is done from memory pools. Each memory pool can provide yet unused memory when it is needed. However, it does not support individual deallocation. The memory can be returned only all at once, the whole memory pool. This allows returning whole areas or structures without crawling trough pointers.
There are few kinds of pools: - Permanent pools, persistent_pool and strpool that last for the whole run of program. They are for the kind of data that is needed until the end, or until it is stored to the cache (as storing to cache is the last think that is done). It however does not survive restart (used when searching for the top-level directory). - Temporary pools, created locally for some task. Example of such task is execution of a single object, loading from cache or creating of a plan. After the task is finished, the whole pool is returned. - Pools for special purposes. There is for example configuration pool, which survives even restart.
Variables are evaluated in a lazy manner — only when they are needed. However, the variable exists in a promise form, it is marked as yet not computed. When the variable is needed, it gets evaluated and pointer to the variable structure is redirected to the new value. The yet not evaluated structure is global — all the pointers point to the same one.
Many structures are read-only. When a change is needed, the old one is replaced by new one. It allows reusing of the values — many pointers may point to the same structure.