Automatic Memory
Also known as: memory management garbage collector gc reference counting arc rc ownership borrow copy on write malloc free
● Advanced4 minBefore this: Values, Not ReferencesSpec 6.1
You never allocate or free memory yourself, and there is no garbage collector that pauses your program.
Kavach frees a value the moment its last use ends. There is no collector running in the background, so a program never stops for one, and memory comes back at a point you can predict.
Copying every value would be slow, so the compiler avoids it without you noticing. The sub-pages show how.
One page for each form
What Kavach does for you
Memory is freed at once
No garbage collector and no pauses: a value is freed the moment nothing uses it, at a point you can predict.