You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
DeliveryLabel
is used insideService
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 implementDeliveryLabel
, but we recently realized thatInterned<T>
intentionally leaks memory in order forInterned<T>
to implement theCopy
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 manyDeliveryLabel
instances created over the run of an application. Each run of a workflow could introduce a newDeliveryLabel
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 usesArc
instead of leaking memory. This will meanService<T>
can no longer implement theCopy
trait, but this is not a crucial property for our use case.The text was updated successfully, but these errors were encountered: