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

Don't use Interned<T> for DeliveryLabel #38

Open
mxgrey opened this issue Dec 5, 2024 · 0 comments
Open

Don't use Interned<T> for DeliveryLabel #38

mxgrey opened this issue Dec 5, 2024 · 0 comments
Assignees

Comments

@mxgrey
Copy link
Contributor

mxgrey commented Dec 5, 2024

DeliveryLabel is used inside Service for users to instruct when multiple calls to the same service should queue up or preempt each other.

We've been using Interned<T> from bevy to implement DeliveryLabel, but we recently realized that Interned<T> intentionally leaks memory in order for Interned<T> to implement the Copy trait.

This memory leakage is okay for Bevy since Interned<T> is used for system labels which are bounded in their variety and will use very few of them. Conversely, we could see arbitrarily many DeliveryLabel instances created over the run of an application. Each run of a workflow could introduce a new DeliveryLabel value, so an application that runs for years could eventually leak an enormous amount of memory.

We should introduce our own alternative to Interned<T> which uses Arc instead of leaking memory. This will mean Service<T> can no longer implement the Copy trait, but this is not a crucial property for our use case.

@mxgrey mxgrey self-assigned this Dec 5, 2024
@mxgrey mxgrey added this to PMC Board Dec 5, 2024
@github-project-automation github-project-automation bot moved this to Inbox in PMC Board Dec 5, 2024
@mxgrey mxgrey moved this from Inbox to Todo in PMC Board Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

1 participant