When using .net sdk occured memory leak

i am using CouchbaseNetClient 3.5.2 and Couchbase.Transactions 3.5.1 versions. I want to create a transaction for two process. First process is update document, second process is calling an api. If calling api has an error i want to rollback update document. Its running but i have a memory leak . Do you have any ideas as to why it might happen? I think transaction cannot dispose.

There is a design change since 3.5 in the sub-doc API where it expects MutateInAsync and LookupInAsync results to be disposed. I do see where Transactions has not yet been updated to do those Dispose calls, so this would cause a change in memory behavior.

However, it shouldn’t be causing a memory leak, just inefficient use of the ArrayPool. This could cause memory footprint to be a bit larger due to garbage collection differences, but I wouldn’t think it would leak indefinitely. Can you provide more details around what you’re seeing?

I only call the Transactions.Create method. When I comment out all the other methods as follows, when I start a transaction in this way, I see that the memory increases regularly when I watch it with the profiler.

_transactions= Transactions.Create(cluster,Config);
await _transaction.RunAsync(async transactionContext =>

await transactionContext.RollbackAsync();


Could you provide some before and after memory dumps, preferably after it’s run for some notable period like a few minutes, that we can analyze?

Are you creating new transactions objects for every transaction and never Disposing them? Typically you would just create one and re-use it.

As per me one of the most common reason for this could be that the transaction object is not being properly disposed of after use. CouchbaseNetClient 3.5.2 and Couchbase.Transactions 3.5.1, make ensure that you explicitly dispose of the transaction object once it’s no longer needed.