Open JoeStrout opened 9 months ago
Note that strings are probably a special case, because (1) the are used a lot, and (2) they cannot contain any other references.
So it might make sense to continue using reference-counting for them, reducing the amount of work the GC has to do.
The C++ implementation currently uses reference-counting, which is relatively fast and simple, but can leak circular references.
Switch to another form of garbage collection to fix this problem and bring behavior in line with the C# implementation. Probably either mark-and-sweep, or Cheney's algorithm. The latter sounds like it might perform better, and is simple to implement; see: https://arxiv.org/pdf/1505.00017.pdf