Main Content

Changes in Lua 5.2 - Garbage Collection

Archive - Originally posted on "The Horse's Mouth" - 2012-04-08 23:15:20 - Graham Ellis

The garbage collection changes aren't coding changes - they will effect the internal efficiency and fix some issues there. Ephemeron tables are somewhat linked as they're providing a solution to a garbage collection issuse that required solution.

There's a change to a generational collector at some collection cycles which prioritises speed of collection on that cycle over a thorough collection, with remaining garbage still collected at the next full cycle. Generational collectors are based on the theory that objects are likely to be very shortlived, or to survive for a long period, with few being released and dying in middle age. And that although memory may be split equally between very young and mature objects, the longeivity of the mature objects means that the rate of death and return from a limited garbage collection cycle amongst the young objects is significantly higher per object than for the mature ones.

As even in the writing of programming languages, you'll find parallels elsewhere - in this case look at the Java model - see [here]