Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++: change garbage collection to work with orphaned cycles #127

Open
JoeStrout opened this issue Feb 9, 2024 · 1 comment
Open

C++: change garbage collection to work with orphaned cycles #127

JoeStrout opened this issue Feb 9, 2024 · 1 comment

Comments

@JoeStrout
Copy link
Owner

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

@JoeStrout
Copy link
Owner Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant