Title
h

hackerham

04/06/2017, 10:13 AM
How does cycle collector work?
c

cbruegg

04/06/2017, 10:25 AM
From what I understand, it traverses the object graph and visits each reachable object. When all reachable objects have been visited, it frees the object not yet seen. (Correct me if I'm wrong, here's the source code: https://github.com/JetBrains/kotlin-native/blob/master/runtime/src/main/cpp/Memory.cpp#L740)
o

olonho

04/06/2017, 10:31 AM
it doesn't traverse whole object graph, it implements algorithm known as trial deletion
c

cbruegg

04/06/2017, 10:37 AM
Interesting, thanks. In case anyone else is wondering how it works, I've found section 5.3 here to contain a good description: https://www.cs.virginia.edu/~cs415/reading/bacon-garbage.pdf
h

hackerham

04/06/2017, 1:23 PM
nice, thank you!