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

GC needs to be refactored for safety #149

Open
liquidev opened this issue Feb 8, 2023 · 0 comments
Open

GC needs to be refactored for safety #149

liquidev opened this issue Feb 8, 2023 · 0 comments
Labels
bug Something isn't working correctness safety

Comments

@liquidev
Copy link
Member

liquidev commented Feb 8, 2023

Currently the GC is not fully memory safe. In specific, the Gc<T> type may outlive the GC, and the GC will sweep any GcRaw<T> references that may be stored in it on Drop. Additionally the GC doesn't consider Gc<T> references as roots, which is also quite problematic.

Thus, a few things need to be done:

  • Value gets a lifetime 'e so that it cannot outlive the engine
  • Gc<T> is only permitted for types that implement unsafe trait GcSafe {}, which asserts that you've thoroughly inspected the type for lack of GC references.
    • In the future this may become an auto trait, but user-defined auto traits and negative trait impls are not stable yet.
@liquidev liquidev added bug Something isn't working correctness safety labels Feb 8, 2023
@liquidev liquidev added this to the 0.8.1 milestone Feb 8, 2023
@liquidev liquidev removed this from the 0.8.1 milestone Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctness safety
Projects
None yet
Development

No branches or pull requests

1 participant