jet / propulsion

.NET event stream projection and scheduling platform with CosmosDB, DynamoDB, EventStoreDB, MemoryStore, message-db, Equinox and Kafka integrations
https://github.com/jet/dotnet-templates
Apache License 2.0
177 stars 24 forks source link

fix: Add a 'use' around linked cancellation tokens #221

Closed nordfjord closed 1 year ago

nordfjord commented 1 year ago

I noticed that a lot of the objects that were surviving in my memory leak repro were CancellationTokenSources

image

Adding a use seems to solve for our memory leak

Before

Before

After

After

See this related stack overflow https://stackoverflow.com/questions/6960520/when-to-dispose-cancellationtokensource

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

bartelink commented 1 year ago

Thanks! And great to have the details and charts to accompany it